For more information about how to solve the & quot; outofmemory & quot; error-Linux Enterprise Application-Linux server application, see the following. Last night, after updating the latest resources and server versions on 163, the server encountered an error message "out of memory..." when reading resources, and then the program core dump. After analysis and verification, it is caused by incorrect swap partition size. Linux vm Size = actual mem size + swap size. The actual MEM refers to the physical memory, and the swap size refers to the swap partition. Because our server has added many scenario resources, after the server is started, DB + GAME consumes about 163 GB of virtual memory, while of physical memory is 1 GB, SWAP is also 1G, and the sum of the two is 2G. In addition, the virtual memory occupied by other software and the actual virtual memory size of 2 GB are insufficient, leading to memory overflow errors.
Solution: Set the SWAP size to a larger value. Theoretically, if you set the SWAP size to 4 GB, no matter how large the actual memory is, there will be no problem, because the maximum number of virtual memory that can be accessed by 32-bit programs is only 4 GB.
Specific operations:
1. dd if =/dev/zero of =/tmp/swap bs = 1024 count = 4194304
Create a 4G file/tmp/swap
2. mkswap/tmp/swap
Create the/tmp/swap file as a swap
3. swapon/tmp/swap
Attach swap
4. swapon-s
View the current situation of your swap Partition
5. Add "swapon/tmp/swap" to the/etc/rc. local file to automatically load the swap file when it is started.
Best regards
Dabao (sodimethyl)
Netease online game business department
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