Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in node creation #403

Closed
vikgus1 opened this issue Aug 22, 2023 · 2 comments
Closed

Memory leak in node creation #403

vikgus1 opened this issue Aug 22, 2023 · 2 comments
Labels

Comments

@vikgus1
Copy link

vikgus1 commented Aug 22, 2023

Using Octomap 1.9.8.

Running Valgrind on my Octomap implementation I noticed the following:

==559639== 64 bytes in 1 blocks are definitely lost in loss record 2,913 of 6,399
==559639==    at 0x483E583: operator new[](unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==559639==    by 0x12C9F9: octomap::OcTreeBaseImpl<octomap::OcTreeNode, octomap::AbstractOccupancyOcTree>::createNodeChild(octomap::OcTreeNode*, unsigned int) [clone .isra.0] (in /home/viktor/ros2_ws/src/octomap_impl/build/octomap_server/octomap_server_node)
==559639==    by 0x14C26F: octomap::OccupancyOcTreeBase<octomap::OcTreeNode>::updateNodeRecurs(octomap::OcTreeNode*, bool, octomap::OcTreeKey const&, unsigned int, float const&, bool) (in /home/viktor/ros2_ws/src/octomap_impl/build/octomap_server/octomap_server_node)
==559639==    by 0x14BFCE: octomap::OccupancyOcTreeBase<octomap::OcTreeNode>::updateNodeRecurs(octomap::OcTreeNode*, bool, octomap::OcTreeKey const&, unsigned int, float const&, bool) (in /home/viktor/ros2_ws/src/octomap_impl/build/octomap_server/octomap_server_node)
==559639==    by 0x14C3D3: octomap::OccupancyOcTreeBase<octomap::OcTreeNode>::updateNode(octomap::OcTreeKey const&, float, bool) (in /home/viktor/ros2_ws/src/octomap_impl/build/octomap_server/octomap_server_node)
==559639==    by 0x12D3A2: octomap_server::OctomapServer::insertLidarPoints(tf2::Vector3 const&, pcl::PointCloud<pcl::PointXYZIRR> const&) (in /home/viktor/ros2_ws/src/octomap_impl/build/octomap_server/octomap_server_node)

It seems that elements created with new[] are not freed with delete[]. I looked at the implementation of createNodeChild but couldn't immediately understand where the new[] was happening. I thought this might not be so bad, but after running my implementation continuously for 13 hours I had a crash because Octomap had eaten all the RAM of my pretty high end system. I also know that the memory leak is here and not in my implementation since Valgrind doesn't show any leakage in my implementation.

If anyone could have a look at this or give me a hint of how to fix the issue, I would be very grateful.

@vikgus1
Copy link
Author

vikgus1 commented Aug 22, 2023

Ok I just realized that this was a duplicate of the issue fixed in #288.

@vikgus1 vikgus1 closed this as completed Aug 22, 2023
@ahornung ahornung added the bug label Sep 12, 2023
@ahornung
Copy link
Member

Thanks for the report! Just to be sure - does #288 fix the issue for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants