google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 400 forks source link

Memory problems when adding images (trackers) to AugmentedImageDatabase (runtime) #762

Open L4Hacks opened 4 years ago

L4Hacks commented 4 years ago

SPECIFIC ISSUE ENCOUNTERED

I have an app that only creates an AugmentedImageDatabase in runtime. When adding images to the database, it takes A LOT of memory from my device (almost all memory). I have used Unity profiler to see this, and i'have also bought an asset (from the AssetStore) to check the current available memory [same results - see the attached picture]).

I'm adding images to the database like this: "Texture2Dtex = new Texture2D(2, 2); tex.LoadImage(fileData); AugmentedImageSrc image = new AugmentedImageSrc(tex); db.AddImage(sceneInfo.Id + "-" + triggerInfo.Id.ToString(), image);"

Each time i call this method, my free RAM drops approximatly 250Mb.

This is a really strange behaviour, since if I start the Scene with a AugmentedImageDatabase already populated (with the same images), i get all the available memory free! Is there any way to realese unused memory after adding the images to the database? Is it possible to serialize the database, destroy everything and load it after (to get free memory)?

Also, is there any way to destroy the database and realease the memory? I cant seem to do this.

VERSIONS USED

ARCore

L4Hacks commented 4 years ago

Can anyone help with this? Is there any way to serialize & upload a AugmentedImageDatabase to a server, and download & deserialize it after?

L4Hacks commented 4 years ago

almost 1 month later .. thanks for not helping :/