Date: Wed, 30 Aug 1995 02:05:39 +0200 (MET DST) From: Davide Rossi To: sandmann AT clio DOT rice DOT edu Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: v2 memory crazyness On Tue, 29 Aug 1995, Charles Sandmann wrote: > > this really looks like a big bug somewhere: compile the following code and > > you'll se how v2 eats memory. Nope, it is not a malloc trouble: you can > > obtain the same using new/delete. > > This is a malloc issue and a misunderstanding of what go32_dpmi_get_mem .. > type calls return. First, malloc allocates in 2**n chuncks minus an overhead, > so allocating 4Mb of memory probably grabs an 8Mb chunk. OK, fine for now... > Second, free() > just returns that memory to the internal malloc() pool, not to DPMI. ??? shouldn't malloc release this memory to DPMI too? This way if I malloc() 10Mb and then I free() them the DPMI available memory to "any program" is now 10Mb less? Sure? OK, anyway I can live happily with this behavior too, I just wanted to report that. Also: I'm not sure but maybe in the sample program I sent I was reading DPMI informations before freeing memory. Just a mistype, in the original code free() was before. Another thing: my viewer is almost ready to ship, anyone willing to give me a home for it (I mean a ftp site). The limited version (just few things are missing) is freeware. Ciao, Davide.