What happens if a node runs out of subscriber queue memory?

asked 2020-02-28 00:49:24 -0500

KenYN gravatar image

We have a hard-to-debug memory leak and crash in a complex ROS system, and one suspect I have is running out of memory on our resource-limited target when it tries to receive an Image message. Looking at the source code, I see:

http://docs.ros.org/kinetic/api/roscp...

read_buffer_ = boost::shared_array<uint8_t>(new uint8_t[size]);

If we run out of heap space then that should throw an std::bad_alloc, which we do see, but I'm not sure if there are other layers that might catch this exception, or if ROS has another way of catching memory exhaustion.

What is the recommended way to handle this possibility, other than manually auditing that all our subscribe() calls specify sensibly-sized queues?

edit retag flag offensive close merge delete