Replies: 2 comments 2 replies
-
|
On Android, native resources are managed by the MapLibre Native SDK for Android: https://github.com/maplibre/maplibre-native This library is a Kotlin wrapper of that one. It looks like you're also using another native library to generate the data for the computed source. Have you confirmed the memory leak relates to MapLibre Native resources, not resources from that library? |
Beta Was this translation helpful? Give feedback.
-
Do you have the data indicating this? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🐞 Native memory leak and crash when panning map with dynamic polygon layers
Hi!
I’ve encountered a native memory leak issue when using MapLibre Compose while dynamically rendering a large number of polygons (hexagonal cells) that cover the entire map.
When I actively move (pan or zoom) the map, native memory usage keeps growing until the app eventually crashes.
This is clearly visible in the Android Profiler — the native heap steadily increases during continuous interactions.
It seems like some native resources (layers, tiles, or geometry buffers) might not be released properly during frequent camera movements or map updates.
I created a minimal reproducible project where this behavior can be easily observed:
👉 https://github.com/MAXBAF1/HexMapTest
Below are logs, profiler screenshots, and a short video showing the issue:
📄 Logs:
log1.txt
log2 full.txt
🖼️ Profiler screenshots:


🎥 Video demonstration:
https://drive.google.com/file/d/11YPr1o4PzAnqLw1eBELsycGnVMA5DfCA/view?usp=sharing
Steps to reproduce
Expected behavior
Memory should remain stable or be reclaimed when cells/layers are removed or replaced.
Actual behavior
Native memory usage keeps growing with map interactions and eventually leads to an OOM crash.
Environment
Additional info
The issue becomes apparent only when the map is moved actively for a while — during static use, memory usage remains stable.
Based on profiler traces, it appears that native memory (possibly GPU buffers or internal geometry data) is not released even after layers are removed or replaced.
Could you please check whether this might be a native resource leak related to frequent layer updates or camera movement in the Compose integration?
Thanks a lot for your work on this project 🙏
Beta Was this translation helpful? Give feedback.
All reactions