On Thu, Nov 3, 2016 at 9:27 PM, Carsten Haitzler <ras...@rasterman.com> wrote:
> On Thu, 3 Nov 2016 11:24:14 -0200 Gustavo Sverzut Barbieri 
> <barbi...@gmail.com>
> said:
>
>> I guessed mempool and eina_trash did that
>
> nah - mempool i don't think has a "purgatory" for pointers.
> they are released back into the pool.

well, it could... OTOH it's just for "empty blocks", since if it's in
a mempool that has memory blocks and they're still in use, it will
just flag as unused.

also, it simplifies bookkeeping of the memory if they are all of the
same size, like you said Eina_List, it knows the size of each entry,
thus just need to mark each position that is usable, not try to
allocate based on size or similar -- much more efficient.


> trash is actually a cache for storing ptrs but it never
> actually frees anything. it doesn't know how to. you have to manually clean
> trash yourself and call some kind of free func when you do the clean. trash
> doesn't store free funcs at all.

I don't see why it couldn't.

but I find this is trying to replace malloc's internal structures,
which is not so nice. As you know, malloc implementation can
postpone/defer actual flushes, it's not 1:1 with brk() and munmap()
since like our mempools the page or stack may have used bits that
prevents that to be given back to the kernel.

what usually adds overhead are mutexes and the algorithms trying to
find an empty block... if we say freeq/trash are TLS/single-thread,
then we could avoid the mutex (but see malloc(3) docs on how they try
to minimize that contention), but adding a list of entries to look for
a free spot is likely worse than malloc's own tuned algorithm.


-- 
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to