Xref: news-dnh.mv.net comp.os.msdos.djgpp:1812 Path: news-dnh.mv.net!mv!news.NH.Destek.Net!news2.net99.net!news.cais.net!news.sprintlink.net!newsfeed.internetmci.com!delmarva.com!udel!rochester!cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!news.sesqui.net!uuneo.neosoft.com!news!sandmann From: Charles Sandmann Newsgroups: comp.os.msdos.djgpp Subject: Re: v2 memory crazyness Date: Tue, 29 Aug 1995 12:26:24 CDT Organization: NeoSoft Internet Services +1 713 968 5800 Lines: 19 References: Reply-To: sandmann AT clio DOT rice DOT edu Nntp-Posting-Host: praline.no.neosoft.com To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp > 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. Second, free() just returns that memory to the internal malloc() pool, not to DPMI. The call you are checking sees how much memory which would be available to any program (a nested one, for example) that wanted to use it. BTW, none of this behavior changed between V1.x and V2.0. If your program is sensitive to memory allocation, I suggest looking at another malloc package. > What's worse the memory get lost only when referenced: strip out the zepo Actually this is a cwsdpmi bug - pages don't get counted until they are touched, so you may think you have more memory than you really do.