Re: memory allocations.
- From: Ulrich Drepper <drepper redhat com>
- To: jg pa dec com (Jim Gettys)
- Cc: James Henstridge <james daa com au>, Havoc Pennington <hp redhat com>, Sander Vesik <sv117949 ireland sun com>, Alan Cox <alan redhat com>, Chris Chabot <chabotc reviewboard com>, iain <iain ximian com>, gnome-hackers gnome org
- Subject: Re: memory allocations.
- Date: 01 Mar 2002 01:22:37 -0800
jg pa dec com (Jim Gettys) writes:
> by some care, we arranged to allocate related objects simultaneously
> in a single malloc and reduced the number of calls to malloc by a
> substantial factor (2-3x), while saving the memory overhead as well,
> also saving substantial overhead and improving memory footprint and
> cache behavior, and avoiding fragmentation.
That's what I've done in many places in glibc. It often pays off even
if it means that you have to do some work twice: first to determine
the size, and then to copy the data. Sometime you can simplify the
copying by arranging the data in a form which allows easy copying.
This temporary allocation could use single linked lists allocated with
alloca(). The only problem is that one has to know that the input is
reasonably sized to avoid overflowing the stack.
--
---------------. ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Red Hat `--' drepper at redhat.com `------------------------
_______________________________________________
gnome-hackers mailing list
gnome-hackers gnome org
http://mail.gnome.org/mailman/listinfo/gnome-hackers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]