ROS2 TensorRT Composable Node: Cannot allocate memory in static TLS block

Hi all, I am currently creating a ROS2 composable node on a Jetson Orin NX 16Gb Jetson Linux 36.2 that performs inference on a TensorRT Engine. I have written the code, although whenever I create a CudaStream, I received the error:

Failed to load node ‘exp_node’ of type ‘rss::Exp’ in container ‘/events’: Failed to load library: Could not load library dlopen error: /home/anthony/catkin_ws/install/rss/lib/ cannot allocate memory in static TLS block, at ./src/shared_library.c

I have seen various posts on this forum previously on similar issues involving changing the LD_PRELOAD variable, although none of these have worked for my setting. Would anyone have any advice on how to go about solving this error?


Does the TensorRT app work outside of the ROS2 container?
If yes, which container do you use?

Is it from the jetson-container GitHub?


At the moment, I am not using any container to run the ROS2 code. I am running directly on the Jetson Linux OS and ROS2 Iron was directly installed in this environment.

For further context, the code works if the node is created as an executable. Although, when creating a shared library version of the code for use in a composable node, I receive the TLS error. As mentioned above, I went through the code and removed portions until the error did not pop up when executing and discovered it was as soon as I created a CudaStream that I receive this error.


Could you share the command you run for the LD_PRELOAD variable?
Does the below work?

export LD_PRELOAD=/home/anthony/catkin_ws/install/rss/lib/


Thanks for the suggestion, changing this inside the launch files environment variables fixed the error!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.