Contact SalesSitemapCustomer Login

Prevent: Compiling Yields 'Cannot allocate memory'

Contents

[edit]

Compiling Error

Take a look at this page, it explains the problem with gcc's memory allocation and the settings to fix it. Basically gcc assumes that it has the entire physical memory available instead of just the VPS memory, so it tries to use too much.


(This doesn't work)

[edit]

Abstract

Sometimes compiling certain things from source I've received a "virtual memory exhausted: Cannot allocate memory" error. The following is a quick tip to maybe allow gcc/libtool/make/whatever to finish their duty.

[edit]

Tip

Use the ulimit command to restrict the amount of virtual memory allowed. For instance, if you have a VPSLink 1 account, you could do:

[root@vps /]# ulimit -a

That displays the current limits. Then you can change it to something a little lower than your account limit, say:

[root@vps /]# ulimit -v 60000

Play around if need be with the different switches, and amounts.

To change back to normal, just type:

[root@vps /]# ulimit -v unlimited

Good luck avoiding the exahused virtual memory monster.

[edit]

Debian

On Debian (tested only on Debian) if you set ulimit -m instead of ulimit -v it will have the intended effect.

 [root@vps /]# ulimit -m 60000
Retrieved from "http://wiki.vpslink.com/Prevent:_Compiling_Yields_%27Cannot_allocate_memory%27"
Recent Changes | RSS RSS Feed