当前位置:网站首页>Swap swap partition
Swap swap partition
2022-08-09 09:10:00 【Hu Letian】
Problems to fix
When compiling doris, I reported such a problem, the memory is insufficient, and my poor cloud has 2G memory, and then I found a solution in Baidu, swap (at first glance, it is very familiar, ha,But the last letter is p not g) swap partition.
virtual memory exhausted: Cannot allocate memory
Details
We have already established a swap partition during the installation of the system. Swap is also called a swap partition, which is a special hard disk space.When the actual memory is not enough (such as my poor 2G memory), the operating system will extract some temporarily unused data from the memory and put it in the swap, so that the memory will have free space.
Use swap to swap partitions, which will exist in almost all operating systems. There is no way, how cheap hard disks are, this is the most affordable.
Operation steps (for linux)
1. Check the memory usage of the system first
# free -m
2. Create a custom directory
# mkdir /opt/images/# rm -rf /opt/images/swap
3. Create a 2GB file
Generally speaking, the capacity of the swap partition should be larger than the size of the physical memory. It is recommended to use twice the memory, but not more than 2GB.
# dd if=/dev/zero of=/opt/images/swap bs=1024 count=2048000
4. Turn the created file into a SWAP partition
# mkswap /opt/images/swap
5. Use this partition file
swapon /opt/images/swap
6. Check whether the partition file is valid
# free -m
7. Remember to close swap after using it
# swapoff /opt/images/swap# rm -f /opt/images/swap
边栏推荐
猜你喜欢
随机推荐
算术表达式求值演示
define 可变参数定义
全球19级谷歌卫星地图免费查看下载
无符号整数文法和浮点数文法
【环境搭建】tensorrt
mysql-5.5.40的完全卸载
微信小程序转支付宝小程序注意事项
嵌入式之串口中断只能收到一个字节
【场景化解决方案】搭建数据桥梁,Dslink打通泛微系统连接流
Amplify Shader Editor手册 Unity ASE(中文版)
nodeMCU(ESP8266)和RC522的接线图
[V&N2020 Open] Memory Forensics
MySQL事件_单次事件_定时循环事件
ctfshow-web入门 文件上传篇部分题解
go Antlr重构脚本解释器如何实现
NodeMCU(ESP8266) 接入阿里云物联网平台 踩坑之旅
UE4 RTS 框选功能实现
Getting started with ctfshow-web Part of the file upload part solution
MySQL锁
【场景化解决方案】OA审批与金智CRM数据同步