Re: g_malloc overhead



On Mon, 2009-01-19 at 18:43 +0100, BJörn Lindqvist wrote:
> Actually, a custom allocator could be useful even in the general case.
> Malloc is a system call and has quite bad performance on certain
> platforms (windows in particular i think). Something like the gslice
> allocator could
> Probably improve performance a bit.

malloc is a library call.

It's not worth changing memory allocators unless you have a good
solid understanding of how your program uses memory, and have
done *very* detailed timings.

The main trade-offs are between space, time and complexity of code.

Errors in malloc() or other memory code can be very difficult to
find and debug, so it' an area to avoid if at all possible.

Having said all that, yes, using g_slice may help in some cases.
But you need to do timings and profiling, of course.

Liam

Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]