Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

How to increase perl memory space ?

by Anonymous Monk
on Apr 05, 2007 at 18:51 UTC ( [id://608530]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks, I have a perl script to create an excel sheet having more than 10,000 records. While running the script i am getting Out Of Memory!Is there any idea ? How to check perl memory space and how to increase memory space in per to avoid this error ?

Replies are listed 'Best First'.
Re: How to increase perl memory space ?
by kyle (Abbot) on Apr 05, 2007 at 19:41 UTC

    If your environment is restricting how much memory you can have, you might be able to inspect and change this with ulimit, but my guess would be that you're simply exhausting physical memory.

    You can measure the size of Perl data structures at run time with Devel::Size.

    You can use something like DBM::Deep to write a large hash to disk instead of holding it in memory.

    If you're building a large Excel spreadsheet in memory (which it sounds as if you are), I don't know how to help that (besides just having more memory). In that case, at least Devel::Size will be able to tell you.

Re: How to increase perl memory space ?
by davidrw (Prior) on Apr 05, 2007 at 18:59 UTC
    if it 's out of memory, then it's out of memory -- there's nothing to increase, except obviously buy more ram (what, btw, are you starting out with?)...

    But the problem is probably in inefficiency somewhere -- if you post your code we can comment on it, point out any potential or actual problems, and suggest solutions/alternatives ...
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: How to increase perl memory space ?
by BrowserUk (Patriarch) on Apr 05, 2007 at 19:47 UTC
Re: How to increase perl memory space ?
by roboticus (Chancellor) on Apr 06, 2007 at 04:01 UTC
    If you're using cygwin, then you'll want to tell it to give you more RAM, as it defaults to a reasonably small amount. See my earlier post on this issue...

    ...roboticus

Re: How to increase perl memory space ?
by swampyankee (Parson) on Apr 06, 2007 at 15:46 UTC

    Memory limits are controlled by the O/S (or a virtual machine running within an O/S); a Perl program will be running as an application, and applications can only request resources.

    Before running out and buying more memory (frequently a good idea, but often anathema to corporate IT management), I would suggest looking at ways to revise the algorithm to use less memory. Quite a few of the monks could give you help in this regard.

    emc

    Insisting on perfect safety is for people who don't have the balls to live in the real world.

    —Mary Shafer, NASA Dryden Flight Research Center

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://608530]
Approved by gube
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-26 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found