in reply to memory leak Issue

I was wondering if I am doing something wrong

There really is no way to tell from the sub selection of the code you've chosen to post.

You mention "thread", but there is nothing to indicate whether you mean threads, or if that's a euphamism for fork, or a simply a colloqualism meaning a new client.

There is also mention of "Clone()" in the comments, which could be significant--or not.

The only thing that stands out as being worthy of closer scrutiny is:open(DEBUG,">$DEBUG_LOG");

Re-opening the same glob filehandle, never checking for success, and never closing it, in a concurrent environment, might or might not be a problem.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."