Best way to access ARCameraBaseBehaviour.FrameUpdate?

0 votes
asked May 18, 2018 by ngc6543 (1,670 points)
reshown May 23, 2018 by ngc6543

Hi,

I'm trying to access the current camera image feed by adding a listener to `ARCamereBehaviour.FrameUpdate`.

Due to the fact that the CameraDevice might not be ready, I check the readiness like this :

    void EasyARCam_FrameUpdate(ARCameraBaseBehaviour arg1, Frame arg2)

    {

        if (arg2.Images.Count > 0)

        {

            isFrameReady = true;

            crntFrameImage = null;

            crntFrameImage = arg2.Images[0];

        }

        else

        {

            isFrameReady = false;

        }

    }

I don't need to access the current image every frame, so I just keep the latest reference of the first image(crntFrameImage = arg2.Images[0];).

But the above method causes huge memory leak on the native(Unmanaged) side of EasyAR plugin. The profiler shows no memory spikes, but the Activity monitor on my mac shows that the app consumes huge amount of memory(minimum ~200mb, but rises rapidly to over 3GB then drop). On my actual project, this goes more than 10GB, and the app is not usable anymore.

I tried to force the crntFrame.Dispose() but it didn't fix the issue.
Can you give me a little tip on how to use the ARCameraBehaviour.FrameUpdate? I'm wondering how the RealityPlaneBehaviour work.

Please log in or register to answer this question.

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