Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Memleak" in test-script for memleak ... #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sadrak
Copy link

@Sadrak Sadrak commented Jun 16, 2015

OK, this is not really a memleak, but the $mech-object keeps a history up to 8675309 entries and for normal sites this can get huge!
-> for testing memleaks we don't need the $mech history


I was hunting a memleak with the code from Leak-Hunting in my app and at the end, after many hours spend i was totally confused that the memleak must be in Template::Toolkit! After adding many whitespaces to a template, the memleak gets bigger.

After some sleep and thinking about the test script i found the "memleak" in 3 minutes. Keeping all the rendered stuff alive in the $mech object won't help to find memleaks. So i added a "don't keep history" option to the $mech object and now i don't have a memleak anymore!

From the documentation of WWW::Mechanize:

=head2 $mech->stack_depth( $max_depth )

Get or set the page stack depth. Use this if you're doing a lot of page
scraping and running out of memory.

A value of 0 means "no history at all." By default, the max stack depth
is humongously large, effectively keeping all history.

OK, this is not really a memleak, but the $mech-object keeps a history up to 8675309 entries and for normal sites this can get huge!
-> for testing memleaks we don't need the $mech history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant