apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David McIver <david.mci...@optimatics.com>
Subject Re[2]: Freeing individual memory allocations allocated by apr_pcalloc()
Date Tue, 21 Jun 2005 23:52:52 GMT
Tuesday, June 21, 2005 at 10:39:39 PM, Jeff typed:

JT> On 6/21/05, Steve doh <tfif@hotmail.com> wrote:
>> I have a heavily used linked list of memory objects allocated using
>> apr_pcalloc().
JT> ...
>> How do I free the memory for a single object in this list after it has been
>> unlinked from the list?

JT> you can't

Something like this may be a workable solution ...
. have your list data structure store the objects that have been unlinked
  from the list
. when you need a new object, use one of the previously unlinked objects
. only allocate a new abject if no unlinked ones are available.

At least this way the memory used by your list would be bounded.

Cheers,
David


Mime
View raw message