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.
Thank you for the response.
I have also updated the DCM with the newest version but it does not solve the issue.
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.
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.
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.
As MartyG said, that the problem is about I did not release the memory.
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.
Thank you for sharing how you solved the issue.
I’ll inform the corresponding team of your experience.
Have a nice day.