[comp.os.msdos.programmer] dynamic mem allocation question

shaunc@gold.gvg.tek.com (Shaun Case) (03/30/91)

I'm using Borland C++ 2.0 to develop an application that will handle large 
amounts of transient information.  I am using the compact memory model.
I am having some problems, which are almost certainly due to wild pointers;
however, while staring at my code, I suddenly noticed that I am using both
malloc() and farmalloc() in the same program.

The only thing I use malloc() for is to allocate some string space.  That is,
I have an array of char pointers, and for each one, I malloc some space, then
free() it when I'm done.  Everything else (all linked list stuff) uses 
farmalloc() and farfree().

My question is, is this safe?  As I understand it, there is no near heap in the
compact memory model, so what happens when I use malloc()?  Is Borland C++
clever enough to malloc space from the far heap, and return it properly, or
is stuff getting clobbered?

Incidentally, I am not using any of the OOP extensions, nor any of the 
windows stuff, just straight ANSI C.

Shaun.