slice allocator misuse?
nickschermer at gmail.com
Wed Aug 9 20:59:32 CEST 2006
2006/8/9, Brian J. Tarricone <bjt23 at cornell.edu>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> On 8/9/2006 11:36 AM, Jasper Huijsmans wrote:
> > * Use g_slice_* functions when available at compile time.
> Why are we going nuts about the slice allocator? From the glib docs:
> "Memory slices provide a space-efficient and multi-processing scalable
> way to allocate equal-sized pieces of memory, just like the original
> GMemChunks (from GLib <= 2.8), while avoiding their excessive
> memory-waste, scalability and performance problems."
>From the same doc: [...] For newly written code it is recommended to
use the new g_slice API instead of g_malloc() and friends, as long as
objects are not resized during their lifetime and the object size used
at allocation time is still available when freeing.
> This makes sense for some things, like allocating arrays that need to
> grow and shrink (actually maybe not even here), or repeated alloc/free
> in a loop, or lots of instances of the same struct, etc. But why for
> things like one-time dialog structs, etc.? I guess the questions is: is
> a single g_slice_alloc() faster than a single g_malloc()? If not, some
> of these 'use the slice allocator' patches are seriously misusing it...
Maybe the dialogs are a bit 'overkill', but it probably doesn't matter.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v18.104.22.168 (MingW32)
> -----END PGP SIGNATURE-----
> Xfce4-dev mailing list
> Xfce4-dev at xfce.org
More information about the Xfce4-dev