http://qs321.pair.com?node_id=688198


in reply to Re: Memory usage of a "sub" in mod_perl
in thread Memory usage of a "sub" in mod_perl

Thnaks for all answers, they were quite usefull.

Iīve many circular refs, and now I weakened them, which reduced slightly the memory usage. But still the process grows and donīt free its memory.

100K HTML isnīt a big problem, but some times I have a 10mb ou 30mb structure in memory, which then generates a 3 mb HTML. And thats the problem.

Iīm sure there arenīt circular refs anymore, but system doesnīt reclaims memory. I think this is the normal behavior, and Apache2::SizeLimit is the only solution for this. Am I right?

But I still canīt undestand why it says the sub "end" is eating all this memory! I would understand if it says there is a global variable or something, but why a sub? For example, the perl-stats Memory Usage of the Html::page package says:
128:       undef PV    44 bytes html
129:       undef NULL  24 bytes 0xa7f4cb8
130:       undef PV   37740 bytes Content-type: text/html
Cache-Control: no-cache,no-store,max-age=0
Pragma: no-cache

<html>... ALL MY PAGE HERE 2 MB OF DATA!!!

Why is it still arround? Iīve done a $page->{html} = ''; in the DESTROY method and Iīm sure it was invoked. And, by the way, it has nothing to do with the sub "end". "end" just parses $page->{html}, then flushes it to the browse and then undef $page->{html}. Shouldnīt "undef" be enouth?

Thanks monks!

Diego de Lima