googlearchive / tango-examples-c

JNI example projects for Project Tango [deprecated] C-API
https://developers.google.com/ar
Apache License 2.0
337 stars 204 forks source link

Memory leak in TangoSDK #103

Open lvonasek opened 7 years ago

lvonasek commented 7 years ago

When I use Tango3DR_clear it removes data from it but it does not deallocate memory (it is problem for texturing and reconstruction context). Also Tango3DR_ReconstructionContext_destroy does not deallocate it completely.

I did following test with cpp_mesh_builder_example: -change resolution: Tango3DR_Config_setDouble(t3dr_config, "resolution", 0.005); -make it scan more far: Tango3DR_Config_setDouble(t3dr_config, "max_depth", 7.5); -remove mesh extraction (it is too slow for test) -do measurement when clear button is pressed:

        text += new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + ": ";
        ActivityManager.MemoryInfo mem = new ActivityManager.MemoryInfo();
        ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);

        //pause scanning and measure memory
        TangoJNINative.onToggleButtonClicked(false);
        activityManager.getMemoryInfo(mem);
        text += (mem.availMem / 1048576L) + "MB -> ";

        //clear context
        TangoJNINative.onClearButtonClicked();

        //measure memory and resume scanning
        activityManager.getMemoryInfo(mem);
        text += (mem.availMem / 1048576L) + "MB\n";
        TangoJNINative.onToggleButtonClicked(m3drRunning);

        //show result
        MeshBuilderActivity.this.runOnUiThread(new Runnable()
        {
          @Override
          public void run()
          {
            Toast.makeText(MeshBuilderActivity.this, text, Toast.LENGTH_LONG).show();
          }
        });

result: tango_hopak_leak

jchernobieff commented 7 years ago

Thank you for the bug report lvonasek, we are currently looking into it.

lvonasek commented 7 years ago

Thank you. The problem happens also after calling Tango3DR_TexturingContext_destroy

lvonasek commented 7 years ago

After update on Tango Ikariotikos memory leaks in Tango3DR_TexturingContext seems to be fixed but the problem with Tango3DR_clear still stays

lvonasek commented 7 years ago

Issue stays in release m20.