virtual memory exhausted: Cannot allocate memory
2016-10-18 02:24
387 查看
~$free total used free shared buffers cached Mem: 1017832 784328 233504 356 12844 14692 -/+ buffers/cache: 756792 261040 Swap: 0 0 0 ~$dd if=/dev/zero of=swap bs=1024 count=1024000 1024000+0 records in 1024000+0 records out 1048576000 bytes (1.0 GB) copied, 6.30189 s, 166 MB/s ~$ll swap -rw-rw-r-- 1 ubuntu ubuntu 1048576000 Oct 18 02:48 swap ~$mkswap swap Setting up swapspace version 1, size = 1023996 KiB no label, UUID=1372d681-b265-469b-8d9d-d637cbedbef7 ~$sudo swapon swap ~$free total used free shared buffers cached Mem: 1017832 947088 70744 356 1692 189112 -/+ buffers/cache: 756284 261548 Swap: 1023996 0 1023996 ~$sudo swapoff swap ~$free total used free shared buffers cached Mem: 1017832 947844 69988 356 1744 189728 -/+ buffers/cache: 756372 261460 Swap: 0 0 0
创建一个名为swap的文件作为交换区.
首先要设置该文件的大小,使用dd文件复制命令从if复制到of,复制count次,每次复制bs大小的空间.
然后将swap文件格式化为交换区,使用"mkswap 文件名"命令,该命令会是swap文件腾出4*1024B(即为4页)的空间专门作为交换区头部.
最后"swapon 文件名"命令打开交换区,此时查看内存就能够看见swap区的大小了.
不想用交换区之后,用swapoff关闭交换区,关闭之后就可"rm swap"删除交换区了.
相关文章推荐
- 编译安装php时遇到virtual memory exhausted: Cannot allocate memory
- virtual memory exhausted: Cannot allocate memory
- 编译时:virtual memory exhausted: Cannot allocate memory
- 编译安装php时遇到virtual memory exhausted: Cannot allocate memory
- 编译安装php时遇到virtual memory exhausted: Cannot allocate memory
- virtual memory exhausted: Cannot allocate memory 解决方法
- virtual memory exhausted: Cannot allocate memory
- 云端Ubuntu:Virtual memory exhausted:Cannot allocate memory
- 编译时:virtual memory exhausted: Cannot allocate memory
- 阿里云ECS云服务器编译安装PHP遇到virtual memory exhausted: Cannot allocate memory
- android4.4编译失败,出现“virtual memory exhausted: Cannot allocate memory”
- 编译时:virtual memory exhausted: Cannot allocate memory
- virtual memory exhausted: Cannot allocate memory
- virtual memory exhausted: Cannot allocate memory
- 编译安装php时遇到virtual memory exhausted: Cannot allocate memory
- 编译QT程序出现virtual memory exhausted: Cannot allocate memory
- Linux编译时:virtual memory exhausted: Cannot allocate memory
- 编译时:virtual memory exhausted: Cannot allocate memory
- linux下由于内存不足造成的 virtual memory exhausted: Cannot allocate memory, qt **.o文件 file not found
- virtual memory exhausted:cannot allocate memory