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

Re: Strings and numbers: losing memory and mind.

by oha (Friar)
on Sep 28, 2007 at 13:48 UTC ( #641530=note: print w/replies, xml ) Need Help??

in reply to Strings and numbers: losing memory and mind.

you have 1 million of undef before reading, and 1 million of string after reading.

those strings have an average of 150-200 bytes each, so they are alot bigger then undef


  • Comment on Re: Strings and numbers: losing memory and mind.

Replies are listed 'Best First'.
Re^2: Strings and numbers: losing memory and mind.
by kyle (Abbot) on Sep 28, 2007 at 15:18 UTC

    What you write is mostly true but not very relevant.

    First, a correction: I originally wound up with 50 million strings averaging about 2.57 characters each (note that I split each line as it's read).

    The fact that I'm replacing lots of undef with lots of strings isn't the problem. I observed that process, and when it was done, I had a certain amount of memory used. The problem is that memory usage continued to grow as I operated on (but did not add to) the arrays I'd created.

    The problem is caused by the fact that Perl is converting all those strings to numbers for me on the fly. My solution was to force them to be numbers in the first place (instead of strings). Now, when I operate on the set, it stays the same size.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2023-05-28 16:29 GMT
Find Nodes?
    Voting Booth?

    No recent polls found