http://www.perlmonks.org?node_id=490678


in reply to A different kind of Spreadsheet::ParseExcel memory problem.

A quick look with Data::Dumper shows me that Spreadsheet::ParseExcel has circular links in its structures. Namely, the S::P::Cell objects have a Format key which refers the parent object. Thus, if those links are not weakened, the structure will not be released properly when the objects go out of scope.

To fix this would probably require a patch involving the use of weaken in functions that make S::P::Cell objects, or DESTROY methods which do that when the object is about to be garbage collected.

If a patch is not an option for you, you could carefully fork a new process for each file or break up the task in some other way.

Phil

Replies are listed 'Best First'.
Re^2: A different kind of Spreadsheet::ParseExcel memory problem.
by jcoxen (Deacon) on Sep 10, 2005 at 03:22 UTC
    I'm sorry I took so long to respond to your suggestion but it takes a while for my script to run and I wanted to let it finish before I replied. I was very intrigued by your idea. I was planning on implementing forking but not until after I had everything else working. Regardless, I went ahead and put it in. And it worked! 846 files and no 'Out of Memory' errors.

    Thank you very much for the help

    Jack