Problems with use of memory on HelloARCSharp.

0 votes
asked Oct 15, 2021 by guillermobarreiro (120 points)

Hello,

I am tring to get the image projection matrix on the HelloARCSharp example. This is the code that I wrote:

var frame = oFrame.Value.AddToAutoRelease(ar);
if (!frame.inputFrame().hasCameraParameters()) { return; }

var image = frame.inputFrame().image();
var width = image.width();
var height = image.height();

var cameraParameters = frame.inputFrame().cameraParameters();
float viewportAspectRatio = (float)width / (float)height;
Matrix44F imageProjection = cameraParameters.imageProjection(viewportAspectRatio, screenRotation, true, cameraHorizontalFlip);

I believe that I have to release an object because the use of memory increase linearly.

I tried to add to AutoRelease the image or cameraParameters but it doesn't work.

Can anyone help me, thank you.

Regards.

1 Answer

0 votes
answered Oct 15, 2021 by kenn (18,750 points)

Dispose everything that are disposable when goes out of scope.

And try not cascade like frame.inputFrame().cameraParameters(), you are missing a chance to dispose InputFrame.

Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...