Re: eval + no warnings = no memory
by clintp (Curate) on Jan 30, 2001 at 05:47 UTC
|
Interestingly, it has nothing to do with warnings per se.
Simply running
perl -e "eval 'no strict;' while (0==0);"
But if you use eval BLOCK, this doesn't happen:
perl -e "eval {no strict;} while (0==0);"
Won't. This is odd, and cause for a bug report.
| [reply] [d/l] [select] |
(tye)Re: eval + no warnings = no memory
by tye (Sage) on Jan 30, 2001 at 07:16 UTC
|
Temporary "scratchpad" variables are not free()d until (roughly) the end of the statement. This statement never ends so each eval allocates a bit of temporary space and these never get free()d.
You can test this by making the loop only repeat a few hundred times and then put that in a bigger loop and see the memory grow initially but then level out as the hundreds of temporaries get free()d each time around the bigger loop.
But I haven't tested this theory, it just seems pretty danged likely. (:
-
tye
(but my friends call me "Tye")
| [reply] |
|
| [reply] |
|
Ah, thanks for the info. From elsewhere in this thread, it sounds like the leak is in "stringy" eval for some versions of Perl on some platforms. I'm sure the porters would appreciate a bug report with the data collected so far. (:
-
tye
(but my friends call me "Tye")
| [reply] |
|
|
Re: eval + no warnings = no memory
by MeowChow (Vicar) on Jan 30, 2001 at 04:21 UTC
|
Interesting... it doesn't soak up memory on my Linux Perl 5.005_03 or my Win32 ActiveState Perl 5.6, but it does on my Linux v5.6 and my Win32 Cygwin 5.6...
update: as lemming pointed out, it actually does leak memory under 5.005_03, only very very slowly. It's more of a drip, than a leak, really. | [reply] |
Re: eval + no warnings = no memory
by AgentM (Curate) on Jan 30, 2001 at 04:15 UTC
|
I ran this on some corporate-grade servers and I also got "Out of Memory!" after 30 seconds or so. What's recursive about this or where is the memory leaking?
AgentM Systems nor Nasca Enterprises nor
Bone::Easy nor Macperl is responsible for the
comments made by
AgentM. Remember, you can build any logical system with NOR.
| [reply] |
Re: eval + no warnings = no memory
by Fastolfe (Vicar) on Jan 30, 2001 at 03:29 UTC
|
Is it really eating up memory or are you wondering why it's pegging your CPU? If it's the former, that almost sounds like a bug. If it's the latter, presumably you are aware that the code above is an infinite loop... | [reply] |
|
gryn@echor:~/test$ ./test.pl
Out of memory!
gryn@echor:~/test$
The infinite loop is just keep the program running :) .
| [reply] [d/l] |
Re: eval + no warnings = no memory
by gryng (Hermit) on Jan 30, 2001 at 02:17 UTC
|
Grr, wherefore dost my formating break :P , sorry.
Gryn
| [reply] |
|
| [reply] |
|
Thanks ZydecoSue, I swear that I did! :) But something stripped
them. I have bad luck with these sorts of things :) .
Ciao,
Gryn
| [reply] |