On Mon, Apr 17, 2000 at 11:12:24AM -0700, Perrin Harkins wrote:
> [EMAIL PROTECTED] wrote:
> > Now with modperl the Perl garbage collector is
> > NEVER used. Because the reference count of those variables is never
> > decremented... it's because it's all in the registry, and it's hard to
> > tell... hmm... what should I throw away, and what should I keep? ;-).
>
> What I know about Perl internals could fit on the head of a pin, but
> this strikes me as a very odd statement. If the garbage collector is
> never used, why do my lexical variables go out of scope and get
> destroyed? There are mod_perl packages like Apache::Session that
> absolutely depend on garbage collection of lexical variables to work.
> Are you saying that destroying the variables and actually reclaiming the
> memory are separate, and only the first is happening?
Go out of scope, yes. Destroyed, no. Want to test? No problem. Do
the following in a perl script.
my($funnything);
print"Value of funnything is $funnything";
$funnything="Uh oh... check this out";
You'll find some interesting results on your second interation :-).
Even funnier might be the folowing...
dosomefunnystuff();
sub dosomefunnystuff {
my($funnystuff);
if($funnystuff eq "funny") {
dosomefunnystuff();
}
print "Funnystuff is $funnystuff";
$funnystuff="funny";
}
Try that, and you will truely find out how memory inefficient modperl
is :-). I haven't tested that second one, but based on what I know
about how perl works... it should prove... interesting.
Thanks,
Shane.
>
> - Perrin