X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f Message-ID: <3CE3FF64.E0F0D953@yahoo.com> Date: Thu, 16 May 2002 14:50:13 -0400 From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: emacs under w2k References: <3CE3990C DOT 308C92EC AT yahoo DOT com> <1225-Thu16May2002182200+0300-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Eli Zaretskii wrote: > > > Date: Thu, 16 May 2002 07:33:32 -0400 > > From: CBFalconer > > > > > > Actually, the main problem is to be able to join many small free'd chunks > > > into larger chunks. If you fail to do that, you'll hit the problem of > > > being unable to allocate memory for reading a file because the free pool > > > is fragmented. Then you'll need to sbrk more from the OS. > > > > nmalloc handles this. > > Without any limitations? How do you overcome the problem of joining > non-contiguous chunks? (Sorry, I don't have time to read the code and > figure that out myself.) If the various sbrk calls returned something non-contiguous (the unexpected returns) nothing can join those. However everything in a contiguous sbrk chunk, whether created by one or several sbrk calls, will be rejoined when all components are freed. nmalloc keeps track of adjacent allocations and rejoins them when freed. Adjacent free blocks are always joined into one larger block. It also attempts to do any new allocations from the free space list on something close to best fit, and avoids sbrk calls as far as possible. The test code can do many allocations/frees/reallocs, and all blocks are rejoined at exit, as proven by the debuggery output and the tnmalloc driver. This was a fairly sensitive test that I hadn't fouled up, and was not always true. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net) Available for consulting/temporary embedded and systems. USE worldnet address!