apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: [ADDON] apr_malloc/apr_realloc/apr_free on per pool basis
Date Wed, 19 Dec 2001 21:26:54 GMT
On Wednesday 19 December 2001 12:29 pm, Mladen Turk wrote:

> I understand that 100%, but as you said, lets go further... I think of apr
> as the best peace of code that I've ever seen. The pools as concept is
> excellent, but IMO there has to be the way that someone use the apr as a
> genereral libc. For example try to implement a simple recursive sorting
> algorithm using apr, and you will end up with cca. 1GB for a 10000 elements.
> IMO there has to be some kind of a implicit free, or the apr will become
> something like java or vb that no-one really knows how the bugger really
> works.
> 
> In general I only want to be able to do a simple thing like:
> !SYSTEM.FREEMEM 101000
> char *dummy = apr_palloc(somepool, 1000);
> !SYSTEM.FREEMEM 100000
> apr_pfree(somepool, dummy);
> !SYSTEM.FREEMEM 101000

So there is a hack to do this, that will work:

#define apr_malloc()   apr_subpool_create()
#define apr_free()       apr_destory_pool()

Ryan

______________________________________________________________
Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Mime
View raw message