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


in reply to Re: Delete parse data spreadsheet::parseexcel
in thread Delete parse data spreadsheet::parseexcel

simply stop keep a reference to the parser object. Then the memory allocated for that object is freed.

No, not for Spreadsheet::ParseExcel objects...they contain circular references (workbooks reference worksheets and vice versa, etc.), so they don't go away until the end of your program. Best thing to do is to parse each spreadsheet in a separate process (using Parallel::ForkManager or just plain fork or just launch a separate system command or something).

  • Comment on Re^2: Delete parse data spreadsheet::parseexcel

Replies are listed 'Best First'.
Re^3: Delete parse data spreadsheet::parseexcel
by moritz (Cardinal) on Feb 06, 2013 at 00:53 UTC
    they contain circular references (workbooks reference worksheets and vice versa, etc.), so they don't go away until the end of your program

    If that's really the case, please open a bug report.

    However the source does use Scalar::Util::weaken, and my very basic testing shows that the objects do get released when I set the reference to the workbook to undef.

      Looks like you're right. This has been fixed since around 2007 in v0.30.