Memory leake trigered by the realsense pipeline code c++ in Visual Studio 2017
std::shared_ptr<rs2::pipeline> __pipe;
__pipe = std::make_shared<rs2::pipeline>();
int count = 0;
while (true)
{
rs2::config cfg;
cfg.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_BGR8, 15);
cfg.enable_stream(RS2_STREAM_DEPTH, 640, 480, RS2_FORMAT_Z16, 15);
__pipe->start(cfg);
Sleep(20000);
__pipe->stop();
Sleep(10000);
std::cout << ++count << std::endl;
}
When I run the program, I find a memory leak. After each __pipe->stop(), the memory will increase by 0.3m ~ 0.5m. Does pipeline not release rs2::config every time the camera is turned off?
-
Hello, there is a case in the link below where a memory leak when starting after stop was reported, though it is associated with using query_devices(), which you are not doing in your script.
https://github.com/IntelRealSense/librealsense/issues/8091
Within that case though is a comment by another RealSense user with a leak whose counter may more closely fit the technique that you are using. In that comment, they describe the fix that they applied to resolve the issue.
https://github.com/IntelRealSense/librealsense/issues/8091#issuecomment-759975908
Please sign in to leave a comment.
Comments
1 comment