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
[C++] Memory Leak caused by rs2::syncer #6337
Comments
I have not programmed a syncer myself and so my analysis is based on general programming principles. So I apologise if I make an error on this particular subject. If wonder if you could try putting a copy of the stop() and close() statements inside the brackets of the if (input == "q") keypress listener, to try to make sure that the close routine is called when the 'q' key is pressed. For example: if (input == "q") |
Thank you for a quick response. I don't think ensuring sensor stop & close there would help, Anyway, I have replace the closing sequence with the code below, but the leak persists. if (input == "q")
{
try
{
color_sensor.stop();
depth_sensor.stop();
color_sensor.close();
depth_sensor.close();
}
catch (const rs2::wrong_api_call_sequence_error &) { /*pass*/ }
break;
} |
I will tag this issue as a "Bug" to draw the developers' attention to it. |
Yes, I can approve the bug. From limited investigation I was unable to find root cause yet, but we will continue to look into it. |
Thanks for investigating. I could implement an external syncer using frame_queue for now, but it would be lost effort if this was to be fixed easily. |
I will close this issue as the fix has been merged! |
SDK build flags
Issue Description
There seems to be a huge memory leak when using rs2::syncer when passing
syncer to rs2::sensor::start(syncer) for one or more sensors.
Leak does not occur when using rs2::frame_queue.
I am using Visual Studio's Memory profiler feature to capture heap profile.
According to the profiler, memory for
std::shared_ptr<librealsense::frame_archive>
allocated inlibrealsense::make_archive
atlibrealsense::frame_source::init
is not deallocated even after the destructor of rs2::syncer is called.I have provided a sample code which reproduces this every time.
Feel free to tell me if I am doing something I am not supposed to or if there is anyway I can improve SDK usage.
Simple Sample Code for Reproduction
The text was updated successfully, but these errors were encountered: