httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Gröver <>
Subject Re: Question about malloc / realloc in module
Date Wed, 14 Sep 2011 13:13:29 GMT

Hi Joshua,

Thank you for your answer.

> If you malloc/calloc/realloc without a free you will leak memory.
Well, I use free(). I have implemented counters which prove that for
every malloc there's a free() called with normal operations.

But what if a process exists in a faulty way. Perhaps some PHP code
that exists abnormally?

> Do you have some reason to believe that another module might prevent
> your module's calls to free() from being run?  What do you have in
> mind specifically?

I have a system in which I encounter an Apache with a rapidly
growing memory consumption. Memory usage grows in a linear way.

Though I can see that in normal operation (on a test system) I have a
free() called for every malloc(), I can't debug this on  a production
system with much more load going on.

> You can also mimic realloc by just allocating more memory from the
> pool and calling memcpy.  The old memory will leak into the pool but
> be resolved on pool cleanup.

Perhaps I will try this, if I have the feeling that memory leaks
are the cause for the growing memory usage.

Thank you for your suggestions.

Christoph Gröver,
Sitepark Gesellschaft für Informationsmanagement mbH, AG Münster, HRB
5017 Rothenburg 14-16, D-48143 Münster, Telefon (0251) 48265-50
Geschäftsführer: Dipl.-Phys. Martin Kurze, Dipl.-Des. Thorsten Liebold

View raw message