Hello list,
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.
But what if there's a problem in another module?
Is it possible that due to some
If you malloc/calloc/realloc without a free you will leak memory.
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?
You can also mimic realloc by just allocating more memory from the pool and
On Wed, 14 Sep 2011 14:01:19 +0200
Christoph Gröver gro...@sitepark.com wrote:
So would this result in a memory leak? (if this happens often!)
Potentially yes, unless you can do an exhaustive analysis of all
possible processing paths.
The fix for that is to register a free as a pool cleanup
Thank you, Nick, for your answer,
So would this result in a memory leak? (if this happens often!)
Potentially yes, unless you can do an exhaustive analysis of all
possible processing paths.
The fix for that is to register a free as a pool cleanup
immediately after the malloc/realloc.
But what if a process exists in a faulty way. Perhaps some PHP code
that exists abnormally?
If the process exits, you've got no worries about memory. If a thread
hangs [indefinitely], before you can free memory, the memory is
probably the least of your problems.