[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] APR hash table memory use

From: Branko ÄŒibej <brane_at_xbc.nu>
Date: 2004-11-03 01:11:01 CET

Julian Foad wrote:

>Prevent unbounded memory use during repeated operations on a hash table.
>
>The hash table was allocating new memory for each new insertion of an entry,
>and not reclaiming it on deletions, so repetition of (insert, delete) caused
>the memory use to keep growing. This fix causes the memory freed by a deletion
>to be reused by a subsequent insertion, so that the memory used by the hash
>table is proportional to the maximum number of entries that it has ever held
>simultaneously, rather than the number of insertions that have been performed.
>
>* apr/tables/apr_hash.c:
> (apr_hash_t): Add new field "free", a free-list.
> (apr_hash_make, apr_hash_copy, apr_hash_merge): Initialise the free-list.
> (find_entry): Use an entry from the free-list if there is one.
> (apr_hash_set): Return a deleted entry to the free-list.
>
>
This looks good. I vote we apply it on both HEAD and the 0.9.x branch.

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 3 01:11:08 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.