![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged minimal_memory_lock at Robotics Stack Exchange
![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged minimal_memory_lock at Robotics Stack Exchange
![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged minimal_memory_lock at Robotics Stack Exchange
![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged minimal_memory_lock at Robotics Stack Exchange
![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged minimal_memory_lock at Robotics Stack Exchange
![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged minimal_memory_lock at Robotics Stack Exchange
![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged minimal_memory_lock at Robotics Stack Exchange
![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file
Package Dependencies
System Dependencies
Dependant Packages
Launch files
Messages
Services
Plugins
Recent questions tagged minimal_memory_lock at Robotics Stack Exchange
![]() |
minimal_memory_lock package from ros2-realtime-examples repominimal_cpu_affinity minimal_memory_lock minimal_scheduling |
ROS Distro
|
Package Summary
Tags | No category tags. |
Version | 0.0.1 |
License | Apache License 2.0 |
Build type | AMENT_CMAKE |
Use | RECOMMENDED |
Repository Summary
Description | Minimal ROS 2 real-time cookbook recipes |
Checkout URI | https://github.com/ros-realtime/ros2-realtime-examples.git |
VCS Type | git |
VCS Version | rolling |
Last Updated | 2023-06-05 |
Dev Status | UNKNOWN |
Released | UNRELEASED |
Tags | real-time cpp realtime ros ros2 rclcpp |
Contributing |
Help Wanted (-)
Good First Issues (-) Pull Requests to Review (-) |
Package Description
Additional Links
Maintainers
- Carlos San Vicente
Authors
- Carlos San Vicente
minimal_memory_lock
Description
Page faults is a non-deterministic event and should be avoided during real-time execution.
This example shows how to lock the process virtual memory into physical RAM in order to prevent page faults happening during the applications real-time runtime phase.
Requirements
- Adjust permissions for memory locking. Add to
/etc/security/limits.conf
(as sudo):
<your username> - memlock <limit in kB>
Adding some memory stress
While running the examples, you can use stress-ng to generate stress the memory and generate page faults. Run the following command in another terminal before running the example:
$ stress-ng --fault 0 --perf -t 1m
# for newer kernels
$ stress-ng --userfaultfd 0 --perf -t 1m
How to run
No memory lock
By default, the memory is not locked, and we can see some page faults while the node is spinning.
$ ros2 run minimal_memory_lock minimal_memory_lock
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 789, Major: 0]
[WARN] [1651228546.831772017] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[WARN] [1651228547.331783493] [minimal_publisher]: New page faults during spin: [minor: 3, major: 0]
[INFO] [1651228547.831905095] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.331781121] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228548.831736137] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.331774937] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228549.831664055] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.331663058] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228550.831664222] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.331658742] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228551.831660235] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228552.331768024] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228552.831653605] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
[INFO] [1651228553.331652699] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[INFO] [1651228553.831650582] [minimal_publisher]: New page faults during spin: [minor: 0, major: 0]
[WARN] [1651228554.331644228] [minimal_publisher]: New page faults during spin: [minor: 1, major: 0]
Using the --allocate-in-node
we can simulate the node allocating some memory
on the heap when spinning.
If we allocate 50 MBytes each time we can see page faults generated more frequently:
$ ros2 run minimal_memory_lock minimal_memory_lock --allocate-in-node 50
Process memory before node creation: 13 MB
Process memory is not being locked. Memory page faults may occur.
Process memory before spin: 13 MB
Total page faults before spin [Minor: 790, Major: 0]
[WARN] [1651228794.768297975] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228795.268509771] [minimal_publisher]: New page faults during spin: [minor: 12803, major: 0]
[WARN] [1651228795.767921477] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.267221048] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228796.769758758] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.271399242] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
[WARN] [1651228797.773109372] [minimal_publisher]: New page faults during spin: [minor: 12800, major: 0]
Locking the memory
Using the --lock-memory
option we enforce all the process virtual memory
to be locked into the physical RAM memory. Now we expect to see no page faults
in the spin phase.
```bash $ ros2 run minimal_memory_lock minimal_memory_lock –lock-memory Process memory before node creation: 13 MB Process memory before locking: 13 MB
File truncated at 100 lines see the full file