Heap Failure on deallocation of publisher/subsciber
@mjcarroll is already working on this.
Since Feb 15, 2024.
- Dominant language
- C++
- Stars
- 805
- Forks
- 564
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 27
Description
Hi,
I'm getting a heap error when deleting a publisher or subscriber.
My development environment :
- rclcpp humble
- cyclonedds
- Windows 10
- Unreal Engine
- Visual studio 2022
The behaviour is as follows: as soon as I create a subscriber or a publisher, there is no problem, it works normally. I can send and rcv message.
But when they are destroyed, following a request, closing the application, or go out of a scope I get a Heap Failure (Critical Error c0000374).
debug With WinDBG
I investigated, and tried to make a custom allocator because I thought that the problem might come from where my allocation was made.
The behaviour remains the same.
So I compiled rclcpp in RelWithDebug mode to access the symbol. And I found that the error seems to come from the deallocation of the EventHandler.
In the image below, you can see that the event_handlers allocator is an allocator of type st::allocator<....>.
For your information, I've tested this on a non-Unreal environment (colcon build) and I haven't managed to reproduce this error.
I'd like to know a little more about the behavior of custom allocators.
- I Was thinking in my understanding of rclcpp that a custom allocator would do all the allocating, isn't that the case?
- Have you ever seen this kind of behaviour?
- Could the fact that the event_handler uses a std::allocator whereas I use a custom one not be a problem?
- Aren't event_handlers supposed to use the custom allocator?
Too many questions come to mind!
It's quite complicated to debug this kind of thing and if you have any ideas I'd love to hear them.
Thanks !
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.