1. Step through the program with the debugger and check the memory size to see where you are in the code when it increases:
$ perl -de0 Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 0 DB<1> !!ps v PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND ... 4763 pts/1 S+ 0:00 0 1013 4874 4348 0.4 perl -de0 DB<2> @array=(1..1_000_000) DB<3> !!ps v PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND ... 4763 pts/1 R+ 0:01 0 1013 103142 102400 9.8 perl -de0
or,
2. Take a look at "Debugging Perl memory usage" in perldebguts and see if using PERL_DEBUG_MSTATS and Devel::Peek::mstat would help.
...but first look at the output of perl -V and see if it says "usemymalloc=n", in which case you won't have any memory statistics... :-(
In reply to Re: Out of memory!
by quester
in thread Out of memory!
by jesuashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |