当前位置:网站首页>[ROS] Compiling packages packages encounters slow progress or stuck, use swap
[ROS] Compiling packages packages encounters slow progress or stuck, use swap
2022-08-02 14:18:00 【CynalFly】
Linux: Ubuntu 18.04 (Bionic Beaver)
ROS: ROS Melodic Morenia
Directory
I encounter slow progress or freeze when compiling ROS packages, what should I do?
When our ROS master is Raspberry Pi, Jetson, etc., the hardware configuration is limited, especially when compiling large programs and running complex algorithms, the 1G and 4G memory on the master control board may not be enough.This is why we need swap
(swap swap partition is virtual memory in windows, virtualizing the physical hard disk into memory) to solve the problem of insufficient memory.
swap
: is an area on the hard disk.It is part of the machine's virtual memory, which is a combination of accessible physical memory (RAM) and swap space.Swap holds temporarily inactive memory pages.Swap space is used when your OS decides that it needs physical memory for an active process and there is not enough available (unused) physical memory.When this happens, inactive pages in physical memory are moved into swap space, freeing that physical memory for other uses.Note thatswap
has slower access times (about 103) depending on the speed of the hard drive.Don't think of it as a complete replacement for physical memory.Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partition and swap file.
Note
: There are many guides on how much toswap
, often wrong.A common misconception is thatswap
should be double the ram.This is old advice that worked for Windows 98.
Ubuntu's default swap space (swap space) is 2G, enter free -m
in the terminal to view swap
, if the physical memory is enough, it is unnecessaryAdded more.If necessary, before compiling, perform the following operations to temporarily increase the swap space.
1. Create a swap file
The total size of files created by dd is equal to bs * count.This example is 1M*4096 = 4GB.Doing this will take some time.
sudo dd if=/dev/zero of=/swapfile bs=1M count=4096
dd: Copies a file in chunks of the specified size, and performs the specified conversion while copying.
2. Convert Interchange File Format
Formats the file as swap.
sudo mkswap /swapfile
3. Set swap file permissions
We need to set the swap file permissions to 600 to prevent other users from being able to read potentially sensitive information from the swap file.
sudo chmod 600 /swapfile
4. Enable swap file
Open swap
sudo swapon -a /swapfile
5. Mount at boot (not necessary)
If your device performance is not good, you need to permanently increase the swap space.Take action:
sudo gedit /etc/fstab
Then add /swapfile swap swap defaults 0 0
to the fstab file to automatically start the system at boot.
边栏推荐
猜你喜欢
智能指针-使用、避坑和实现
Sentinel源码(六)ParamFlowSlot热点参数限流
CVE-2020-27986 (Sonarqube sensitive information leak) vulnerability fix
网络安全第四次作业
期货具体是如何开户的?
理解TCP长连接(Keepalive)
监管再次重拳出击,后市如何?2021-05-22
Flask框架的搭建及入门
Break the limit of file locks and use storage power to help enterprises grow new momentum
第二届中国Rust开发者大会(RustChinaConf 2021~2022)线上大会正式开启报名
随机推荐
【学习笔记】数位dp
[ROS]ROS常用工具介绍(待续)
配置zabbix自动发现和自动注册。
海明校验码纠错设计原理
深度学习框架pytorch快速开发与实战chapter3
网络安全第二次作业
Break the limit of file locks and use storage power to help enterprises grow new momentum
drf视图组件
网络安全第四次作业
关于Google词向量模型(googlenews-vectors-negative300.bin)的导入问题
第十一单元 序列化器
RKMPP 在FFmpeg上实现硬编解码
监管再次重拳出击,后市如何?2021-05-22
如何选择正规的期货交易平台开户?
Some impressions of the 519 plummet 2021-05-21
Flask-SQLAlchemy
vim复制粘贴_vim如何复制粘贴
rpm包的卸载与安装[通俗易懂]
不精确微分/不完全微分(Inexact differential/Imperfect differential)
drf序列化器-Serializer