Message-ID: <320F2768.2680@pobox.oleane.com> Date: Mon, 12 Aug 1996 14:45:28 +0200 From: Francois Charton Organization: CCMSA MIME-Version: 1.0 To: Leath Muller CC: djgpp AT delorie DOT com Subject: Re: Freeing and not freeing Windoze memory References: <199608112310 DOT JAA16484 AT gbrmpa DOT gov DOT au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Leath Muller wrote: > At the moment, I use several doubly-linked lists to store information used > by my program...and at the end, go to the trouble to free all the nodes using > recursive freeing subroutines... >For large chunks of memory, there is nothing wrong with this. If you do many mallocs on small quantities of memory, you can improve a little on that by mallocking big chunks of memory (what big is depends on your program) that you will "dispatch" as you need. It wastes a bit of memory, but saves a lot of freeing and mallocking time. Also, if you do not need too much memory (several kbytes, 10s of kbytes, but not 100s of kbytes) you can consider using alloca(), which allocates data from the stack. The good thing with it is that your data will be automatically freed when the function you call alloca() in is left, and also it is very fast. The bad thing is that stack length is limited to 256kbytes, so you should not use it for big chunks of data. Hope this helps, Regards, F. Charton