当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
1. LVGL 8.3 在 Visual Studio 2019 模拟器中的环境搭建
公司从零开发微信小程序流程
[Vulnerability reproduction] CVE-2018-7490 (path traversal)
数理逻辑MOOC+知识点总结(未完无待续)
MySQL锁
Anaconda4.8.3介绍、安装及使用教程安装(win10)并修改Jupyter默认工作目录
convert转换时间详解
QT设置exe可执行文件的图标
MySQL索引
数据治理(四):数据仓库数据质量管理
基于 JSch 实现服务的自定义监控解决方案
gin中改进版curd接口例子
define 可变参数定义
常用SQL server语句
MySQL查漏补缺(五)不熟悉的知识点
【环境搭建】onnx-tensorrt
[漏洞复现]CVE-2018-7490(路径遍历)
makefile 遗漏分割符 您的意思是用TAB代替8个空格?
canal工作原理及简单案例演示
第五届蓝帽杯初赛 misc 赛后复现