As you know, Perl uses a
garbage collector which based on controlling of refernces count (like in LISP). If the refereces count of something variable will be zero then the
garbage collector will destroy this variable and free its memory.
In your case, you have a hash and a reference on this hash. When your make
undef of your hash, the hash reference is still existed and point on the memory area.
Maybe this fact is a couse of the memory leak.
I hope that I helped ...
--->
SV* sv_bless(SV* sv, HV* stash);