Topic: High memory consumption (leading to Out Of Memory)


Online Maps seems to keep increasing the number of textures, eventually leading to Out Of Memory errors on mobile (tested on multiple Android devices). Unity's profiler shows an increasing number of textures which seems to be the cause of high memory usage. Inspecting the OnlineMapsCache component also reveals that the memory cache increases above its maximum size (it starts by trimming memory properly but after some time it just increases indefinitely).

Other info:
* Memory increases whenever the map is moved, and increases more dramatically when moving to areas that have not been visited before (probably non-cached areas)
* I have a relatively large number of markers on the scene that are constantly added and removed but they are being pooled, reaching a point where no memory allocation is necessary when a marker is added.
* I'm using the control script (found in this forum) that allows smooth zoom on mobile devices.
* Out of Memory seems to occur when the total memory used by the application reaches 1.1GB (on Android, tested on OnePlus X, Samsung Galaxy A5 and Sony Xperia XA)

Online Maps version:
Map size (pixels): 2048x2048
Map size (scene): 2048x2048
Memory cache: 10MB (30% unload)
File cache: 30MB (30% unload)

On a side note, is there any particular reason why you're using an array instead of a list to store 3D markers? This causes serious problems (too many allocations) when performing marker addition/removal in great quantities. For this reason, I replaced the implementation to use a List but this was after the memory problem was discovered.

Re: High memory consumption (leading to Out Of Memory)

Would like to hear about this too. Been having some memory issues lately..

Re: High memory consumption (leading to Out Of Memory)


Thanks for the bug report.
I did some tests and it seems to me that the bug occurs when there is not enough space in the cache to store all the tiles.
Try to increase the memory cache size up to 30-40 MB.
Or disable Online Maps Cache.
Does memory leak occur in such cases?
Please let me know about the results.

About markers:
Long time ago (in Unity v2.x and 3.x) Unity Editor had problems with serialization and displaying lists in Inspector. Therefore, we used arrays. Now this is quite difficult to fix without breaking compatibility.
In Online Maps v3, all marker logic is moved from Online Maps script and Controls scripts into separate components and lists are used.

Kind Regards,
Infinity Code Team

Re: High memory consumption (leading to Out Of Memory)

Increasing the memory cache to 30 MB seems to solve the problem. I will keep testing and if the problem arises, I will report here again.

Thanks for your help! Looking forward for the next major update!