Mail Archives: djgpp/2002/01/20/22:00:22
Eli Zaretskii wrote:
>
> 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.
No, but ending the usage of this package does not necessarily mean
program exit. I am not particularly trying to fix it, as long as
it is not my fault. The problem is on free, not malloc. I am
primarily trying to call attention to a generic failing.
As I said elsewhere, lccwin32 uses the CRTDLL.DLL windows package,
which has the same problem. At least I suspect so.
--
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT XXXXworldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
(Remove "XXXX" from reply address. yahoo works unmodified)
mailto:uce AT ftc DOT gov (for spambots to harvest)
- Raw text -