optimal way to use Memory Chunks



Hi all,

I was considering to use the GMemChunk infrastructure for some of my
code, where often 50 till 5000 structs of 4 bytes are allocated. I will
use the G_ALLOC_AND_FREE mode, because many items are not used after a
while, but not all.

I am, however, wondering if GMemChunk has much overhead. Is there much
searching time involved looking for the next free element if the number
of items become large? And how large would that be? And if the number of
elements is at a time actually very little, is there much overhead using
GMemChunk instead of g_malloc() ?

Summarizing: the question is when *not* to use GMemChunk, and when *to
use* GMemChunk.

thanks,
        Olivier Sessink




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