X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Eli Zaretskii Newsgroups: comp.lang.c,comp.os.msdos.djgpp,comp.compilers.lcc Subject: Re: hash library - interface criticisms Date: Sun, 20 Jan 2002 20:39:13 +0200 Lines: 19 Message-ID: <3C4B0ED1.3F274F98@is.elta.co.il> References: <3C4ADB8E DOT 552CAE40 AT yahoo DOT com> NNTP-Posting-Host: 192.116.55.139 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1011552141 34183748 192.116.55.139 (16 [61365]) X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com John wrote: > > As a follow-up, I just did a test inserting 500,000 nodes of a linked list, > this involves setting the previous and next pointers and the data item, > amongst other things. This took 280ms. (I have quite a fast machine) > > To free the same 500,000 nodes it takes 9,236ms, and the code in this case > is only walking through the list and calling free(). I think the DJGPP implementation of malloc is optimized for allocations more than deallocations. But you can easily see where're the hot spots if you compile malloc.c from the library with -pg, link with -pg, and then profile the test program. That's the beauty of Free Software: the sources are freely available to study and scrutinize. I have no idea what does lcc use in its library. Btw, a program should not need to free its heap before it exits. The OS will take care about it.