in reply to Enforce Memory Cleanup
I suggest that you reduce your code to the minimum possible that demonstrates the problem. In doing so you might solve the problem yourself, but if not then you'll have something useful to show us and then we can help you. You will also, of course, need to show us some sample data as well.
In Section Seekers of Perl Wisdom