On Jan 3, 4:10 am, [EMAIL PROTECTED] (Yitzle) wrote: > Hi. > I've got two scripts I am running and they both consume large amounts > of memory (10MB). > How would I go about finding where the memory is being used and > figuring out how to reduce the memory footprint. > > Both scripts start off with: > > #!/usr/bin/perl > use warnings; > use strict; > use WWW::Mechanize; > use HTTP::Cookies; > use Term::ReadKey; > > Would removing a "use" help? I can disable strict and warnings while > not editing the script. And Term::ReadKey isn't really needed. > Is it possible that Mechanize is using a really large amount of RAM? I > set the stack_depth to 1.
Hello, You can use Devel::DumpSizes [1] in order to trace the memory usage of each variable at a given point during your script. Also, you can check out for cyclical memory objects which consume larger amounts of memory using Devel::Cycle [2]. This should give you some useful insight on structures you can limit. Hope this helps, Spiros [1] http://search.cpan.org/perldoc?Devel::DumpSizes [2] http://search.cpan.org/perldoc?Devel::Cycle -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/