in reply to do + <DATA> = leak

Don't know what sort of leak you are talking about. When I tried to run it, it just waits for me to hit the return key.

perl -h explains that the -n switch assume while (<>) { ... } loop around program, so it is waiting for input from STDIN.

So I kept hitting <ENTER>, and watched the memory usage of perl on another terminal. The memory usage seemed quite stable at 4224k. Note that I did not have the close(DATA) line in my test script.

Replies are listed 'Best First'.
Re: Re: do + <DATA> = leak
by bsb (Priest) on Dec 03, 2003 at 03:18 UTC
    My real file has a lot more lines of "AAAAA"s.

    It does seem to leak for me:

    $ yes|perl -nwe 'BEGIN {print "$$\n"} do "file_with_DATA.pl"; print `p +s -o rssize $$`' 26279 RSS 1120 RSS 1128 RSS 1132 [..etc..] RSS 5564 RSS 5572 RSS 5576
    This is perl, v5.6.1 built for i386-linux
      Ah... I see it. I am using perl 5.6.1 for sun-solaris. The memory leak remains even after I add the close(DATA);