http://qs1969.pair.com?node_id=415129


in reply to recursive reference delete subroutine

Simply
undef $ref;

should do it for you -- if its referent's reference count drops to zero, its memory will be freed automatically (and so on, recursively.)

Keep in mind, the memory is only freed for reuse by your program, not to the OS, but that shouldn't be hurting you here.

So my guesses would be that either you have a memory leak, or that you just plain don't have enough memory for your current algorithm with the data you're using, and you'll have to be cleverer about the algorithm -- no amount of undeffing or deleting is going to save you.