当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
swap交换分区
The difference between big-endian and little-endian storage is easy to understand at a glance
Redis高可用
营养与健康(HIT2021秋)
mysql-5.5.40的完全卸载
小程序/app触底加载更多数据
中国打造国产“谷歌地球”清晰度吓人
长辈相亲
解决iframe跳转时父页面仍然存在的问题
BUUCTF MISC刷题笔记(一)
The embedded serial port interrupt can only receive one byte
RDMA
CPU主频 外频 芯片组 倍频 cache FSB PCI简介
【环境搭建】tensorrt
【环境搭建】onnx-tensorrt
epoll LT和ET 问题总结
往二维数组追加键值
MySQL查漏补缺(二)排序检索、过滤数据、模糊查询、正则表达式
MySQL锁
支付宝小程序使用自定义组件(原生)