-3
$\begingroup$

I've identified a memory leak issue in ROS 2 Humble running on Jetson Orin NX. When components repeatedly allocate memory without proper cleanup, the system shows continuous memory growth.

Reproduction Steps:

# Create a simple node that continuously allocates memory
    def __init__(self):
        super().__init__('leaky_component')
        self._stored_data = []
        self.timer = self.create_timer(1.0, self.timer_callback)

    def timer_callback(self):
        # Allocate memory without cleanup
        new_data = np.random.rand(1000, 1000)
        self._stored_data.append(new_data)

Observed Behavior:

Memory usage increases linearly No memory recovery between allocations System becomes unstable over time

System Details:

ROS 2 Humble NVIDIA Jetson Orin NX JetPack 6.1

Has anyone else encountered this issue? What's the best practice for handling memory cleanup in ROS 2 components?

New contributor
melhsa is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
$\endgroup$

1 Answer 1

2
$\begingroup$

Memory usage increases linearly No memory recovery between allocations

This is expected behavior, and it is correct behavior given what your code told the computer to do.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.