Virtual Memory Exhausted:cannot Allocate memory

Source: Internet
Author: User

Turn from: http://www.cnblogs.com/chenpingzhao/p/4820814.html


Problem Description:

The Linux server was purchased with 512MB of memory.

When compiling PHP will prompt: Virtual memory Exhausted:cannot Allocate memory, compilation failed.

Workaround:

This problem occurs because the server does not have enough memory to cause the compilation to fail.

The purchase of Linux server, does not give you the allocation of virtual memory, so you can increase the virtual memory by the way to solve

1 2 3 4 5 [Root@iz25p0h5gthz ~]#  free-m       &NB sp;        total       used        free     shared    buffers     Cached Mem :           994        707         287          0          11        -/+ Buffers/cache :        638        356 Swap:             0          0           0

Second Step

1 2 3 4 5 6 7 8 [Root@iz25p0h5gthz ~]# mkdir/usr/img/[Root@iz25p0h5gthz ~]# rm-rf/usr/img/swap [Root@iz25p0h5gthz ~]# dd if =/dev/zero of=/usr/img/swap bs=1024 count =2048000 2048000+0 Records in 2048000+0 Records out 209715 Bytes (2.1 GB) copied, 48.7514, 43.0 MB/s

Third Step

1 2 3 4 5 6 7 8 9 10 11 [Root@iz25p0h5gthz ~]#  mkswap/usr/img/swap             Mkswap:/usr/img/swap:warning:don ' t erase bootbits sectors          on Whole disk. Use-f to force. Setting up Swapspace version 1, size = 2047996 KiB no label, uuid=9982f566-9e44-4495-be0b-51d309873112 [Root@iz25p0h5gthz ~]# Swapon/usr/img/swap [Root@iz25p0h5gthz ~]# free-m           & nbsp;   total       used       free      shared    buffers     Cached mem:            994        924          70          0           1       -/+ buffers/cache:        653         swap:         1999           0       1999

You can turn off swap when you've finished using

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.