I note that at no point do you call
tm_NNH, which I assume to be your temperature calculation, and you call the undefined subroutine
tm_Base_Stacking which has the same argument list. You are also missing a sigil (
$) in front of
iupac. This tells me you did not publish the code that is actually giving you difficulty. Please post the code you are using in the future, or at least make sure Perl can compile what you post - see
How do I post a question effectively?.
A look at your tm_NNH subroutine as posted shows no obvious reason why you would have memory leaks. I also note that your find_degenerates subroutine creates a large number of objects - in my mind, these would be the most likely source of your memory woes. I would suggest using Devel::Monitor to make sure the objects are actually being garbage collected.