Re: GSlice with tight memory (Re: Help Needed)



On Tue, 22 Aug 2006, Soeren Sandmann wrote:

Tim Janik <timj imendio com> writes:

whether you benefit in terms of memory size by using GSlice instead of
malloc/free depends heavily on your application. simply watch your
memory requirements with G_SLICE=always-malloc and without it.

In general, I'd recommend just always using

       g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, 1);

This way the various tools, valgrind and memprof, will work with your
application, and you don't get any surprises with pathological cases
causing run-away caching. The speed difference between g_slice and
g_malloc is basically noise as soon as you include the time to
initialize the new block of memory.

in general? that is certainly bogus, if what you said was true, there'd
be no point in having GSlice in the first place. do you have any benchmark
(data) that backs up your claims?
as for valgrinding memory allocated through GSlice, that's being worked on:
  http://bugzilla.gnome.org/show_bug.cgi?id=335126

If it does turn out that malloc() shows up on a profile (either memory
or speed), those specific cases can be fixed. With application
knowledge you can do a better job than any general purpose allocator.

that is certainly right.

Soren


---
ciaoTJ



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