oalders / html-restrict

HTML::Restrict - Strip away unwanted HTML tags
Other
10 stars 9 forks source link

Use a weak reference to HTML::Parser, eliminating circular ref. #15

Closed bleargh45 closed 11 years ago

bleargh45 commented 11 years ago

When the HTML::Parser object is created in "_build_parser", it holds a reference to "$self" (the HTML::Restrict object) in the closures used to do the parsing. That creates a circular reference between the HTML::Parser object and the HTML::Restrict object, which then causes us to leak memory every time we're used (as neither of the objects will ever get freed).

So, weaken our handle to the HTML::Parser object, breaking the circular reference.

oalders commented 11 years ago

Thanks so much for this! Sorry it took me so long to get to it.

bleargh45 commented 11 years ago

On May 1, 2013 08:41:46 PM Olaf Alders wrote:

Thanks so much for this! Sorry it took me so long to get to it.

No worries! Glad to see that its getting in and going up. :D

Graham TerMarsch