Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: memory leak in maplibre-gl-native #1

Open
brendan-ward opened this issue Mar 7, 2022 · 2 comments
Open

BUG: memory leak in maplibre-gl-native #1

brendan-ward opened this issue Mar 7, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@brendan-ward
Copy link
Owner

Detected in Linux docker container, using valgrind:

==591== 64 bytes in 1 blocks are definitely lost in loss record 1,973 of 2,123
==591==    at 0x483BE63: operator new(unsigned long) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==591==    by 0xE1BF0CD: ???
==591==    by 0xD950063: ???
==591==    by 0x4011B89: call_init.part.0 (dl-init.c:72)
==591==    by 0x4011C90: call_init (dl-init.c:30)
==591==    by 0x4011C90: _dl_init (dl-init.c:119)
==591==    by 0x53E5894: _dl_catch_exception (dl-error-skeleton.c:182)
==591==    by 0x401642C: dl_open_worker (dl-open.c:758)
==591==    by 0x53E5837: _dl_catch_exception (dl-error-skeleton.c:208)
==591==    by 0x40155F9: _dl_open (dl-open.c:837)
==591==    by 0x599234B: dlopen_doit (dlopen.c:66)
==591==    by 0x53E5837: _dl_catch_exception (dl-error-skeleton.c:208)
==591==    by 0x53E5902: _dl_catch_error (dl-error-skeleton.c:227)
==591== 
==591== 5,355 bytes in 255 blocks are definitely lost in loss record 2,121 of 2,123
==591==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==591==    by 0x53243BE: strdup (strdup.c:42)
==591==    by 0xD4906F6: ???
==591==    by 0xD4904A4: ???
==591==    by 0xD42F0B9: ???
==591==    by 0x7498436: ??? (in /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0.0.0)
==591==    by 0x7498E1C: __glDispatchMakeCurrent (in /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0.0.0)
==591==    by 0x4EF9ECD: ??? (in /usr/lib/x86_64-linux-gnu/libEGL.so.1.1.0)
==591==    by 0x260B21: mbgl::gl::EGLBackendImpl::activateContext() (in /tmp/build/tests/pymgl_test)
==591==    by 0x2E0BF7: mbgl::gfx::BackendScope::BackendScope(mbgl::gfx::RendererBackend&, mbgl::gfx::BackendScope::ScopeType) (in /tmp/build/tests/pymgl_test)
==591==    by 0x3A3DD8: mbgl::Renderer::~Renderer() (in /tmp/build/tests/pymgl_test)
==591==    by 0x23198D: mbgl::HeadlessFrontend::reset() (in /tmp/build/tests/pymgl_test)
==591== 
==591== LEAK SUMMARY:
==591==    definitely lost: 5,419 bytes in 256 blocks

Looks like a backend is being created within the destructor for the Renderer class.

@brendan-ward brendan-ward added the bug Something isn't working label Mar 7, 2022
@brendan-ward
Copy link
Owner Author

Note that this occurs for both EGL and GLX backends.

@brendan-ward
Copy link
Owner Author

The memory leak only occurs if map is rendered; simply constructing map instances does not trigger it.

The 5,355 bytes lost appears to be stable for the empty style, regardless of how many times rendering is called or how many instances of the map are rendered (e.g., rendering each of 10 maps produces same result as rendering a single map).

Preliminary conclusion: while this is not great, it doesn't appear proportional to load and won't lead to a runaway memory scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant