[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Memory problems in OO context



On Mon, 22 Nov 1999, Peter Hartmann wrote:

> >|...I don't see how I could possibly free up more memory. Am I doing
> >|something wrong here?
> >
> >Yes. As Gisle's note says, you have to *explicitly* delete the html parse
> >tree. Just undefing it doesn't do it, that's *implicitly* deleting it,
> >which doesn't work because of circular references. Replace the undef $html
> >with $html->delete and see if that changes the behavior at all. (And yes, I
> >think that could be stated more clearly in the HTML pods.)
> 
> Yes, this works like a charm. There is still some memory loss in the realm
> of an estimated 10K per iteration, but with this tiny change I was able to
> drop the whole bunch of about a hundred files on the droplet with out
> making MacPerl crash on me for lack of free memory. (Hobby programmers like
> me should be prohibited from tackeling OO stuff....)


Unfortunately, this doesn't seem to solve my problem.  I wasn't using the
HTML::Tree mechanism, and I don't believe ::Parser and ::Filter have
circular references.

I undef $p (my filter object instance), checking ref $p before and after.
Before it is true, after it is false, which seems like Perl should then be
able to reclaim it.

Despite this, my memory usage climbs steadily, apparently at close to the
same rate as before (if left running, the process would consume north of
50 MB).  To summarize what I posted before, the actual data structure I am
saving out of the HTML files which I sequentially read is less than 6 MB
on disk, and less than 10 MB in memory.

How can I trim out the other memory?

"Reasonable" would be the memory footprint for one file, plus the entire
data structure, plus a little more.  

As a side note, I wonder if the memory is reclaimed before MacPerl needs
the memory?  Unfortunately, when MacPerl runs out of memory for this
script, it crashes hard (it and my machine and MacsBug all flop on the
ground).  At least in this case; I have seen "out of memory" errors for
other scripts.


--
MattLangford 


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org