gotwols@warper.jhuapl.edu (Bruce Gotwols) (03/26/90)
Under Microsoft-C in the large memory model, I have observed what appears to be a bug in the malloc function. If I allocate an array that extends to the end of the physical 64k page, then I would expect the next call to malloc to return a pointer which starts at the beginning of the next physical 64k page (but because of housekeeping it will be a few bytes higher in memory than this). This is exactly what happens when the array size is below about 50000 bytes. I can go along merrily "mallocing" until I run out of memory. However, for an array size somewhat greater than 50000 (say 52000) the next pointer returned will not start anywhere near the beginning of the next page. In fact it may even start halfway into the page. I cannot see any reason for this behavior since there is nothing I am aware of that should push the pointer higher in memory so that it won't be contiguous to the last block of memory malloced. Has anyone seen this behavior before, and is it a bug, or is there a rational explanation? This is an extremely important question on PC/AT's where direct memory access requires that an array not cross a physical 64k page boundary. Thanks, Bruce -- -- Bruce L. Gotwols Johns Hopkins University, Applied Physics Lab., Laurel MD 20723 Internet: gotwols@warper.jhuapl.edu (128.244.176.48)