X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f Message-ID: <3C68525B.476118E@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Alignment problem References: <3C67DE6D DOT DEE8305C AT yahoo DOT com> <3028-Mon11Feb2002220350+0200-eliz AT is DOT elta DOT co DOT il> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 46 Date: Mon, 11 Feb 2002 23:32:44 GMT NNTP-Posting-Host: 12.90.168.45 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1013470364 12.90.168.45 (Mon, 11 Feb 2002 23:32:44 GMT) NNTP-Posting-Date: Mon, 11 Feb 2002 23:32:44 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > > From: CBFalconer > > Newsgroups: comp.os.msdos.djgpp > > Date: Mon, 11 Feb 2002 15:10:03 GMT > > > > Flat profile: > > > > Each sample counts as 0.0555556 seconds. > > % cumulative self self total > > time seconds seconds calls ns/call ns/call name > > 82.04 9.39 9.39 30001 312952.53 314921.80 merge > [...] > > which puts the problem (going by name) precisely where it was > > expected. > > Yep, pretty much so. It had to be merge. > > > I still don't know how you are organizing the free list, > > In a nutshell, they are kept in linked lists arranged in buckets by > block sizes, each sublist for a size that is a different power of 2. > > Try stepping through malloc and free for several allocations and > deallocations of vastly different sizes, and I think you will see the > pattern clearly. > > > If something identifies such blocks as being free or not, independant > > of the free list, this could be made linear. > > You will see in the code that the LSB of the size/next pointer header > is used as the allocated/free marker. > > > This implies that > > all blocks contain fields for next, size, and one bit for flags. > > Yes, there's a header and a trailer, each one 4-byte long. See teh > definition of struct BLOCK. What defines the sizes for which you keep separate lists? I hate reading OPs source :-) at least without a clear statement of algorithms. BTW, your messages are suddenly supporting references and getting threaded properly! Did you change newsreaders?