Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Out of Memory Error -- Possible Leak?

by ok (Beadle)
on Dec 14, 2005 at 23:44 UTC ( #516808=note: print w/replies, xml ) Need Help??


in reply to Out of Memory Error -- Possible Leak?

When processing ginormous data sets, try to use while instead of for.

for wants to load the entire dataset into memory but while wants to load each datum as you request it.

Replies are listed 'Best First'.
Re^2: Out of Memory Error -- Possible Leak?
by Moron (Curate) on Dec 15, 2005 at 12:23 UTC
    No, the C-style for ( initialisation; termination; iteration ) given in the OP does not duplicate the dataset, only the perl-style for ( list ) and the c-shell-style foreach ( list ) (which did cause the crash in the OP) do that.

    The only time it makes sense to convert the c-style for to while is where there is no initialisation or termination, e.g.: for (;$i<$j;) {} seems a likely candidate for changing to a while.

    -M

    Free your mind

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://516808]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2018-10-15 23:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...














    Results (82 votes). Check out past polls.

    Notices?