From: Harald Koch <chk@po...> - 2002-02-26 23:30:38
I spent some time with a search engine today, and came out with a couple
of tidbits gleaned from the noise. In the spirit of grasping at straws,
I offer them.
The first is that HTML::Element uses doubly referenced objects in a
tree. Each parent node has a reference to all of its children, and each
child node has a back reference to the parent.
Doubly referenced objects like this cannot be returned to the memory
pool by perl's automatic garbage collector, because the reference counts
are never zero.
The discussion pointed out that you have to call the ->delete method on
objects returned by HTML::Parser, and (by inference) on
There are several places in bruce's example code that create a temporary
HTML::TreeBuilder object; these are a potential source of memory leaks.
Another common source of memory leaks in perl are *failed* evals
(although that might be old news).
A couple of perl people have been running perl through Purify, and
fixing several internal memory leaks. Running recent versions of perl is
therefore recommended. The bottom line, however, is that perl isn't very
careful with memory allocation.
Java, anyone? <ducking rapidly>
Harald Koch <chk@...>
Get latest updates about Open Source Projects, Conferences and News.