当前位置:网站首页>[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 thatswaphas 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 thatswapshould 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=4096dd: 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 /swapfile3. 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 /swapfile4. Enable swap file
Open swap
sudo swapon -a /swapfile5. 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/fstabThen add /swapfile swap swap defaults 0 0 to the fstab file to automatically start the system at boot.
边栏推荐
猜你喜欢
随机推荐
【Tensorflow】AttributeError: module ‘keras.backend‘ has no attribute ‘tf‘
Audio processing: floating point data stream to PCM file
C language improvement (3)
方舟生存进化淘宝面板服务器是怎么一回事?
redis分布式锁和看门狗的实现
网络安全第一次作业(2)
RowBounds[通俗易懂]
理解TCP长连接(Keepalive)
RKMPP API安装使用总结
Raft协议图解,缺陷以及优化
drf路由组件Routers
Linux:CentOS 7 安装MySQL5.7
MySQL数据库设计规范
Diodes and their applications
Haystack的介绍和使用
泡利不相容原理适用的空间范围(系统)是多大?
智能指针-使用、避坑和实现
The bad policy has no long-term impact on the market, and the bull market will continue 2021-05-19
线代:已知一个特征向量快速求另外两个与之正交的特征向量
Sentinel源码(二)入口方法分析









![[ROS]ROS常用工具介绍(待续)](/img/ea/e390106f750bf697e62a3a296014d2.png)