NNTP-Posting-Host: 172.16.26.200 Newsgroups: comp.os.msdos.djgpp,comp.games.development.programming.misc Date: Mon, 23 Aug 1999 11:50:38 +0200 Message-ID: <0E16861EE7BCD111BE9400805FE6841F0B116B91@c1s5x001.cor.srvfarm.origin-it.com> From: bas DOT hamstraNOSPAM AT nl DOT origin-it DOT com (Bas Hamstra) Subject: Re: Compacting the Memory References: <7p974q$4gg$1 AT news6 DOT svr DOT pol DOT co DOT uk> X-Newsreader: Forte Free Agent 1.0.82 Lines: 38 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I can fully confirm this experience. I used a database whith chess positions. A lot of records were inserted and deleted. In DOS days, when you had 100kb and freed 10 kb, you automatically had 110 k free RAM. Under Win this is not necessarily the case, due to memory fragmentation. I noticed this with *all* compilers under win. If you want to avoid this I m afraid you have to write your own mem mgt routines. For example alloc larger chunks of mem normally and manage allocs/free's on record-level yourself. Regards, Bas Hamstra. "Ben Davis" wrote: >I am writing a program in DJGPP C, which uses the memory VERY dynamically: >there are loads of malloc()s and free()s. They occur in a strange order, and >some are quite large. If two blocks are allocated, and then the first one is >freed, and then a third, larger block is allocated before the second one is >freed, some memory is wasted (I fear). >What I would like to know is, does DJGPP automatically compact the memory by >moving blocks down to fill all the gaps, or do I have to do it manually? How >can I do this?