当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
SQL server中的数据类型
gin中改进版curd接口例子
第1讲 Verilog基础知识
MySQL查漏补缺(二)排序检索、过滤数据、模糊查询、正则表达式
多维度LSTM(长短期记忆)神经网络预测未来存款余额走势
【场景化解决方案】OA审批与金智CRM数据同步
Where does detection go forward?
MySQL事务隔离
Max Flow P
VoLTE基础自学系列 | IMS的业务触发机制
【环境搭建】onnx-tensorrt
政务中心导航定位系统,让高效率办事成为可能
ctfshow-web入门 文件上传篇部分题解
MySQL创建索引的技巧
没有对象的可以进来看看, 这里有对象介绍
奥维地图电脑端手机端不能用了,有没有可替代的地图工具
[Vulnerability reproduction] CVE-2018-7490 (path traversal)
Where does detection go forward?
【环境搭建】onnxruntime
centos7 mysql异常ERROR 2002 (HY000)分析解决