Perl frees up variables when they fall out of scope or are undefined. Be certain you are using
strict and the perl
-w flag to catch warnings, and that all of your variables are scoped correctly where you're using them. If you're still having problems, consider
undef'ing large variables/objects when you're done with them, assuming they won't fall out of scope shortly thereafter and be destroyed automatically.