in reply to Re: Unexplained memory hogging
in thread Unexplained memory hogging

Thank you everyone for your replies and comments. It has been an interesting discussion.

I actually used zentara's suggestion of forking the large memory section so that once the process ended, the memory was returned. This works well and as I was already using Parallel::ForkManager elsewhere in the code I only had to make a couple of changes to the code so thank you!

For those interested, in addition to following Anonymous Monk's advice and passing the $coverage hashref as an argument to the sub, the other changes I made to get this working as I want were as follows:

That's it. The forked process releases the memory when it finishes and the next process starts afresh.

Cheers,
Rich