in reply to Re: Strange memory growth?
in thread Strange memory growth?

This is still a bug. Try this:

use strict; use warnings; if (1) { my $a = 100; } print $a;

If you are not allowed to ref that $a any more, once exit that if block, there is absolutely no point not to garbage collect it.

Replies are listed 'Best First'.
Re:x3 Strange memory growth? (or Laziness?)
by grinder (Bishop) on Nov 07, 2003 at 22:53 UTC
    there is absolutely no point not to garbage collect it

    Yes there is. It might be cheaper, (read: Lazier) to not garbage collect it at all, and just let the program fall off the end of the world. Just because you can, doesn't mean it's worth spending the effort to do so.

    It was only with the advent of mod_perl and similar long-running persistent perl processes that any serious effort started to be devoted to keeping track of perl's resource usage. It used to be that it was cheaper not to do anything, because in a few milliseconds time, the pages used by the process would be reclaimed by the OS when program ended anyway.

    And given perl's propensity for trading off memory for speed, it doesn't really surprise me that we see the behaviour demonstrated by the OP.

Re: Re: Re: Strange memory growth?
by mce (Curate) on Nov 10, 2003 at 10:10 UTC