opensciencemap / vtm

a vector-tile map library written in java - running on android, desktop and within the browser
GNU Lesser General Public License v3.0
238 stars 176 forks source link

Tiles loading memory usage #137

Open AAverin opened 9 years ago

AAverin commented 9 years ago

There might be an memory issue in tile-loading part of the library, because if I have only 3 maps with not so much details, and I unload them when map is off the visible part of the screen, and then reload again when it shows up - after about 10 such iterations I get OutOfMemory. That means that the same data that is unloaded and loaded again from the file occupies larger amount of memory. Most likely when map is unloaded something is left in the memory and not GC-ed.

Also, when map is just showing up on the screen I keep getting GCs. I'll check if it's a marker layer who's the culpit.

hjanetzek commented 9 years ago

Hard to say remotely which things may not get gc-ed. I suspect the theme textures could be an issue (handling them properly is on my TODO). Though you do not have to load a theme instance for each map. Just reuse a single instance all the time. The DDMS allocation tracker and heap dump could be helpful to investigate where your memory is gone.