Re: GMemChunk - multiple alloc




Elliot Lee <sopwith@redhat.com> writes:

> Would it be possible for someone (else) to make a variant of
> g_mem_chunk_alloc() that allows the programmer to specify how many
> consecutive chunks they want to allocate? I know it "sort of" goes against
> the idea of a GMemChunk, but if it's easy to do I could definitely make
> use of it. 

I assume what you want is to get is N chunks consecutive in memory.
I see a few difficulties:

 - You always have to get new memory - you can't use the free list

 - You might have to abandon the current mem area early, because 
   it didn't have N available spaces. (This messes up accounting
   if you want to deal with freeing the memory)

 - The program would have to free each of the N chunks separately.

Basically, it would be easy to implement for ALLOC_ONLY memchunks,
(though possibly inefficient unless each area holds a lot more
than N chunks) and not very nice at all for ALLOC_AND_FREE 
memchunks. 

So perhaps that has some relevance to whether it is actually
a useful feature or not...

Regards,
                                        Owen




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