Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!brutus.cs.uiuc.edu!psuvax1!rutgers!umn-d-ub!umn-cs!kemp From: kemp@umn-cs.CS.UMN.EDU (Stuart R. Kemp) Newsgroups: comp.lang.c Subject: Microsoft C Problem Keywords: Microsoft C Message-ID: <16894@umn-cs.CS.UMN.EDU> Date: 10 Nov 89 18:45:17 GMT Reply-To: kemp@umn-cs.cs.umn.edu (Stuart R. Kemp) Distribution: na Organization: CSci Dept., University of Minnesota, Mpls. Lines: 37 I have the the following problem using MSC 5.1: (Yes, I have read the manual in an attempt to solve it!) The problem is with malloc() and free(), using large memory module. Following is a contrived example to illustrate: malloc() a large area, then free() it, then malloc() a smaller area, and free() it, then malloc() the large area again. The second time the large area is malloc()ed, it will not be the same as the first area. By carefully contriving an example, it would be possible to have malloc() calls fail when there *IS* enough memory available. MSC gets blocks of memory from DOS, and controls them internally, but it appears that it does not do any merging of adjacent areas, nor any intelligent selection of available areas. The first large malloced area above is still available, but only as a small area, and a larger area. (Thus failure of malloc()'s mentioned above.) In DOS, is is possible to control the allocation strategy - I need something similar for MSC, or a way to force MSC to release internal malloc() areas back to DOS, and let DOS do any merging of adjacent areas. Is there something in the manual that I have missed? Replies via email, please. -Stuart Kemp kemp@umn-cs.cs.umn.edu