- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have found the memory leak still persists in newest version of RealSense SDK (intel_rs_sdk_mw_core_offline_11.0.27.1384)."
My OS is Windows 10.
DCM version is intel_rs_dcm_r200_2.1.27.2853
Is there any previous release that does not have this memory leak?
I did release the memory but it does not have effect. Is my code has anything wrong?
void PXCImage2CVMat(PXCImage *pxcImage, PXCImage::PixelFormat format, cv::Mat *output)
{
PXCImage::ImageData data;
pxcImage->AcquireAccess(PXCImage::ACCESS_READ, format, &data);
int width = pxcImage->QueryInfo().width;
int height = pxcImage->QueryInfo().height;
if (!format)
format = pxcImage->QueryInfo().format;
int type;
if (format == PXCImage::PIXEL_FORMAT_Y8)
type = CV_8UC1;
else if (format == PXCImage::PIXEL_FORMAT_RGB24)
type = CV_8UC3;
else if (format == PXCImage::PIXEL_FORMAT_DEPTH_F32)
type = CV_32FC1;
else if (format == PXCImage::PIXEL_FORMAT_DEPTH)
type = CV_16UC1;
*output = cv::Mat(cv::Size(width, height), type, data.planes[0]);
pxcImage->ReleaseAccess(&data);
return;
}
// inside main function
sm->AcquireFrame(true);
PXCCapture::Sample *sample = sm->QuerySample();
PXCImage2CVMat(sample->color, PXCImage::PIXEL_FORMAT_RGB24, &colorImage);
PXCImage2CVMat(projection->CreateDepthImageMappedToColor(sample->depth, sample->color), PXCImage::PIXEL_FORMAT_DEPTH, &depthImage);
cv::cvtColor(colorImage, curImage, CV_BGR2GRAY);
sm->ReleaseFrame();
Thank you in advance, I really appreciate the help.
Best regards
Williem
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
User feedback suggests that the memory leak is present for both R2 and R3 SDK versions for CreateDepthImageMappedToColor and CreateDepthImageMappedToDepth. As you found, releasing does not fix the leak. Leak reports - for CreateDepthImageMappedToDepth, at least - date back to the original SDK in 2014, so using an earlier SDK version may not solve the problem.
One user found that updating the DCM when they updated their SDK version (instead of only updating the SDK) fixed the leak for them. That was the only instance I found in which someone had been able to fix the leak though. It is not clear if the others had tried updating their DCM when changing SDK version - they did not mention that they had done so when reporting their issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the response.
I have also updated the DCM with the newest version but it does not solve the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Given that memory leaks have been occurring with CreateDepthImageMappedToColor / CreateDepthImageMappedToDepth since 2014, I assume that it is a known issue to the RealSense development team but they have not yet been able to find a solution. It probably falls within the 'will be fixed in a future SDK release' category.
The number of reported cases of leaks in these functions is very low. This may be because most developers do not realize that a leak is occurring though. The low number of reports would probably make a fix a lower development priority. The best way for RealSense users to draw attention to the issue if they are affected by it is to continue to post about it on this forum.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Williem,
I wanted to let you know that Intel is trying to troubleshoot this memory leak.
Could you please tell us how you found this memory leak so that we may reproduce your issue?
How did you find the memory leak and how big of a leak is it?
I'll be waiting for your response.
Regards,
Andres V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just wanted to add, Andres, that some developers have found in recent times that the memory leak seemed to be as a result of not doing a Release() at the end of their script, and if they Released the memory then the leak disappeared.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Andres,
As MartyG said, that the problem is about I did not release the memory.
Instead of
PXCImage2CVMat(projection->CreateDepthImageMappedToColor(sample->depth, sample->color), PXCImage::PIXEL_FORMAT_DEPTH, &depthImage);
The code should be
PXCImage image = projection->CreateDepthImageMappedToColor(sample->depth, sample->color);
PXCImage2CVMat(image, PXCImage::PIXEL_FORMAT_DEPTH, &depthImage);
image->Release();
Thank you for all of your consideration.
I think this problem is solved now.
Regards,
Williem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Helllo MartyG,
Thank you for your comment, we appreciate your contribution.
Regards,
Andres V.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Williem,
Thank you for sharing how you solved the issue.
I'll inform the corresponding team of your experience.
Have a nice day.
Regards,
Andres V.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page