slice allocator misuse?

Brian J. Tarricone bjt23 at cornell.edu
Wed Aug 9 20:48:20 CEST 2006


-----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."

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...

	-brian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (MingW32)

iD8DBQFE2i3i6XyW6VEeAnsRAtWCAKDGjJ8U5clRhbBSWSDOyAWe3A6SHQCgmTHe
LYJL76026wkq9mrW9BfaAOg=
=nmkr
-----END PGP SIGNATURE-----



More information about the Xfce4-dev mailing list