6

I'm getting an Out of memory! message for all installs. I've never used cpan before and I'm not really sure how it works. I did a ulimit on the /.cpan directory and it resulted in unlimited. Here's what I'm looking at:

[/usr/bin]# perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')

cpan> install Term::Readline
CPAN: Storable loaded ok
Going to read /.cpan/Metadata
Going to read /.cpan/sources/authors/01mailrc.txt.gz
Going to read /.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Tue, 19 Jun 2012 11:51:03 GMT
CPAN: HTTP::Date loaded ok

  There's a new CPAN.pm version (v1.9800) available!
  [Current version is v1.7602]
  You might want to try
    install Bundle::CPAN
    reload cpan
  without quitting the current session. It should be a seamless upgrade
  while we are running...

Out of memory!
Terminal does not support GetHistory.
Lockfile removed.
Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
pnkflydgr
  • 665
  • 3
  • 13
  • 22
  • 5
    Memory footprint was one of the reasons that [cpanm](http://search.cpan.org/perldoc?cpanm) exists – Joe Jun 19 '12 at 19:34
  • 1
    show your output of $ulimit -a – Pavel Vlasov Jun 19 '12 at 19:34
  • 1
    According to `CPAN`s *Changes* file, `1.80` was released in 2005. I am assuming the CPAN shell is not really running out of memory, but there is some incompatibility between the presumably stone age `perl` you are running and the rest of the system. What does `$perl -v` print? – Sinan Ünür Jun 19 '12 at 23:50
  • Something must be up with modern perl. I'm on Debian 10 now running 5.28 and CPAN takes more RAM than my entire server had in 2005. – Bill McGonigle Jun 25 '20 at 22:19

6 Answers6

16

This is not about increasing memory, but maybe a solution for you.

You can try use cpanm instead of cpan, so:

This will install cpanm for you

$ curl -L http://cpanmin.us | perl - --self-upgrade

and after you can install modules e.g.:

$ cpanm Task::Plack

cpanm needs much less memory.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
clt60
  • 62,119
  • 17
  • 107
  • 194
6

Another reason is that the user you are using to run cpan has a limit on the amount of memory it can use. Issue these commands to use all available memory:

ulimit -m unlimited
ulimit -d unlimited
TerryB
  • 629
  • 1
  • 5
  • 13
0

On AIX (as tagged), the culprit is probably unset or too small LDR_CNTRL environment variable.

covener
  • 17,402
  • 2
  • 31
  • 45
0

We got the same error (Out of memory!) after AIX Service Packs and Maintenance Level updates. After reinstalling perl to the newest version (compiling from source) the error was gone. We noticed that AIX SP+ML update overwrites the links to our self-installed tools in /usr/bin (make and iconv). We assume the AIX SP+ML update did similar things with the self-installed perl.

0

I've found one solution to CPAN Out of Memory errors is to install swap, assuming you don't have any. There's a good step-by-step tutorial for how to do that on Ubuntu 14.04 (with broader Linux applicability) here.

sir_gelato
  • 310
  • 2
  • 9
0

If the issue is running out of memory while using CPAN (I have a server I do perl dev on which I specifically installed 512 megabytes of RAM on), cpanm is your savior as mentioned above. This particular server will bomb slurping the perl contents file so I can't use cpan to update itself. However cpanm fixed everything the first time I used it, and because of it's ease of use and stability, is the ONLY way I maintain my perl servers.

Ron

Ron
  • 1