Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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.


    Free your mind

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://516808]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2018-07-20 05:15 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (424 votes). Check out past polls.