CPAN shell runs out of memory. How can I give it more memory on Unix?

时光毁灭记忆、已成空白 提交于 2019-12-07 09:48:50

问题


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.

回答1:


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.




回答2:


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



回答3:


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




回答4:


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.




回答5:


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.




回答6:


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



来源:https://stackoverflow.com/questions/11108029/cpan-shell-runs-out-of-memory-how-can-i-give-it-more-memory-on-unix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!