httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Noordhuis <i...@bnoordhuis.nl>
Subject Re: Question about malloc / realloc in module
Date Wed, 14 Sep 2011 13:34:11 GMT
On Wed, Sep 14, 2011 at 14:01, Christoph Gröver <grover@sitepark.com> wrote:
> In a module I have to allocate and reallocate a chunk of memory.
> Because (AFAIK) Apache or its libraries do not support reallocation
> I use the standard functions malloc/realloc (and free), of course.

Don't do that. Use apr_palloc() and copy over the data.

If you're worried about memory wastage, create a child pool and
apr_palloc() from there. apr_pool_destroy() the pool to reclaim the
memory.

Mime
View raw message