p-lr / MapView

A Fast, memory efficient Android library to display tiled maps, with support for markers, paths, and rotation.
Apache License 2.0
184 stars 38 forks source link

Clear memory #34

Closed o4061 closed 2 years ago

o4061 commented 2 years ago

Hello, I tried the demo that you provide and I notice that any time a fragment changed the memory of the old map didn't free even when I use the destroy method. Can you give me some feedback.

p-lr commented 2 years ago

Hello, that's because this demo keeps into the back stack each and every navigated fragment. If you pop the back stack before navigating to a new fragment (using navController.popBackStack()), and if you perform a manual GC into the profiler, you'll see that the previously allocated memory is freed. I should probably update the demo, because keeping previous fragments into the back stack isn't that helpful.

o4061 commented 2 years ago

I think it will work, thank you