[ros-users] [Discourse.ros.org] [Next Generation ROS] Fast-RTPS Memory Usage - Please Help
Ricardo González
ros.discourse at gmail.com
Wed May 3 11:12:12 UTC 2017
Thanks @wjwwood for making me aware of this thread.
After checking what @NotMe has detected, i have been investigating why Fast RTPS requires so much virtual memory. Thanks to this [link](http://wuerping.github.io/blog/malloc_per_thread.html) I've discovered each pthread thread is requiring 72MB. This occurs since a change in glibc-2.15.
I was checking a small program that uses pthread threads and the same program using std threads. A std thread only requires 8MB of virtual memory
Fast RTPS uses [Asio library](https://github.com/chriskohlhoff/asio). In my system Asio library is using pthreads. I was able to configure Asio library to use std thread changing _src/cpp/CMakeFiles.txt_. I changed line 183 with this new line:
add_definitions(-D${PROJECT_NAME_UPPER}_SOURCE -DASIO_HAS_STD_THREAD -DASIO_DISABLE_THREADS)
After this change the HelloWorldExamples is using less virtual memory:
ricardo at ricardodesktop ~/workspace/desarrollo/proyectos/fastrtps >ps aux | grep Hello
ricardo 12502 0.0 0.0 73620 10160 pts/2 Sl+ 13:04 0:00 ./examples/C++/HelloWorldExample/HelloWorldExample publisher
Are good numbers for you?
---
[Visit Topic](https://discourse.ros.org/t/fast-rtps-memory-usage-please-help/1739/15) or reply to this email to respond.
More information about the ros-users
mailing list