Memory allocation strategy

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

 



Hello.

I've got questions about memory pools management and I have found on
the list a related question which was not answered as far as I can
tell:

http://article.gmane.org/gmane.comp.voip.pjsip/13275/match=pj_pool_release

Here is a simple example. I have a hashtable which is instantiated
from the very beginning of my program execution and which lasts until
it ends. Many objects are added and then removed in this table. I need
a pool to insert elements in this table, but I cannot use a global
pool for all of them because it could lead to memory exhaustion. The
solution I have found is to associate a pool to each entry in the
table. So memory is freed when expired elements are removed from the
table and destroyed. Does it sound good? What's your solution?

More generally, how do you handle the problem of memory management
when there can be unlimited successive allocations of objects with a
long lifetime, like in the pjlib's balanced tree or hashtable ? Do you
also use good ol' malloc at the same time?

Thanks.
-- 
David



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux