[comp.sys.ibm.pc] Using malloc in Aztec 3.4

windley@iris (Phil Windley) (02/27/88)

A friend of mine is using the Aztec C compiler (ver 3.4) to write some
image processing software.  He mallocs 2 blocks of 64k each.  There is a
strange behavior in the FIRST block.  If he uses the first block of
malloced space, the program crashes, if he uses the second everything is
fine.  In fact if he mallocs 3 and then runs his program using the 2nd and
3rd, ignoring the 1st, everything is fine.  He is using the large memory
model. 

Here's what I suspect is happening:  malloc doesn't check to see if the
current data segment is too small and just returns what ever is left and
then the 2nd and 3rd mallocs return fresh 64k data segments.  

Has anyone noticed this kind of behavior?  I know enough about the PC to
know it has 64k segments, but most of my experience is on UNIX, so I'm a
little lost here.  Please mail rather than post.  I will summarize if the
results are interesting.

windley@iris.ucdavis.edu
ucbvax!ucdavis!iris!windley



Phil Windley
Robotics Research Lab
University of California, Davis