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

ImGui seems to leaks memory on Linux #4660

Closed
AMS21 opened this issue Oct 18, 2021 · 9 comments
Closed

ImGui seems to leaks memory on Linux #4660

AMS21 opened this issue Oct 18, 2021 · 9 comments

Comments

@AMS21
Copy link

AMS21 commented Oct 18, 2021

Version/Branch of Dear ImGui:

Dear ImGui 1.86 WIP (18502)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201703
define: __linux__
define: __GNUC__=11
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000441
 NavEnableKeyboard
 DockingEnable
 ViewportsEnable
io.ConfigViewportsNoDecoration
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000140E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,64
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler: g++-11.1.0
Operating System: linux 5.10.70-1-MANJARO x86_64

My Issue/Question:
Running the example for glfw with opengl3 with sanitizer flags seems to indicate that memory is leaked.

Standalone, minimal, complete and verifiable example: (see #2261)
Running the following commands:

cd examples/example_glfw_opengl3
CXX="g++ -coverage -fsanitize=address,undefined,float-divide-by-zero -fno-sanitize-recover=undefined -g -fno-omit-frame-pointer -fno-optimize-sibling-calls" make && ./example_glfw_opengl3

and closing the window shows the following output:

=================================================================
==185313==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6280 byte(s) in 3 object(s) allocated from:
    #0 0x7f0a511ab459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f0a4ab0774b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7f0a511ab652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f0a4ab069f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

Indirect leak of 134192 byte(s) in 419 object(s) allocated from:
    #0 0x7f0a511ab459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f0a4ab0774b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Indirect leak of 4662 byte(s) in 344 object(s) allocated from:
    #0 0x7f0a511ab279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f0a4ab072e4  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb2e4)

Indirect leak of 752 byte(s) in 6 object(s) allocated from:
    #0 0x7f0a511ab652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f0a4ab069f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

SUMMARY: AddressSanitizer: 146782 byte(s) leaked in 773 allocation(s).
@BrutPitt
Copy link

BrutPitt commented Oct 19, 2021

Hi

Personally don't think to a ImGui trouble (necessarily ): the references are all inside compiled libraries
Anyway I have tested your example in Fedora 34 with NVidia drivers getting this (similar) report:

=================================================================
==13586==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6280 byte(s) in 3 object(s) allocated from:
    #0 0x7f7147000af7 in calloc (/usr/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f713358d8d8  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf28d8)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7f7147000cb8 in __interceptor_realloc (/usr/lib64/libasan.so.6+0xaecb8)
    #1 0x7f713358cb12  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf1b12)

Indirect leak of 138952 byte(s) in 434 object(s) allocated from:
    #0 0x7f7147000af7 in calloc (/usr/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f713358d8d8  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf28d8)

Indirect leak of 4803 byte(s) in 356 object(s) allocated from:
    #0 0x7f714700093f in __interceptor_malloc (/usr/lib64/libasan.so.6+0xae93f)
    #1 0x7f713358d434  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf2434)

Indirect leak of 752 byte(s) in 6 object(s) allocated from:
    #0 0x7f7147000cb8 in __interceptor_realloc (/usr/lib64/libasan.so.6+0xaecb8)
    #1 0x7f713358cb12  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf1b12)

SUMMARY: AddressSanitizer: 201683 byte(s) leaked in 801 allocation(s).

Instead, in an other computer, always in Fedora 34, but with AMD drivers, i get this (somewhat different) report:

=================================================================
==57345==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6240 byte(s) in 3 object(s) allocated from:
    #0 0x7ff6dbf61af7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7ff6c9306986 in pb_slabs_init (/usr/lib64/dri/radeonsi_dri.so+0xca6986)

SUMMARY: AddressSanitizer: 6240 byte(s) leaked in 3 allocation(s).

@ocornut
Copy link
Owner

ocornut commented Oct 19, 2021

@BrutPitt
Copy link

Disabling ImGuiConfigFlags_ViewportsEnable the report is almost similar (for me):

==18547==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6280 byte(s) in 3 object(s) allocated from:
    #0 0x7f87411c2af7 in calloc (/usr/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f872d78d8d8  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf28d8)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7f87411c2cb8 in __interceptor_realloc (/usr/lib64/libasan.so.6+0xaecb8)
    #1 0x7f872d78cb12  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf1b12)

Indirect leak of 138952 byte(s) in 434 object(s) allocated from:
    #0 0x7f87411c2af7 in calloc (/usr/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f872d78d8d8  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf28d8)

Indirect leak of 4803 byte(s) in 356 object(s) allocated from:
    #0 0x7f87411c293f in __interceptor_malloc (/usr/lib64/libasan.so.6+0xae93f)
    #1 0x7f872d78d434  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf2434)

Indirect leak of 752 byte(s) in 6 object(s) allocated from:
    #0 0x7f87411c2cb8 in __interceptor_realloc (/usr/lib64/libasan.so.6+0xaecb8)
    #1 0x7f872d78cb12  (/usr/lib64/libnvidia-glcore.so.495.29.05+0xdf1b12)

SUMMARY: AddressSanitizer: 151683 byte(s) leaked in 800 allocation(s).

And is identical (with or w/o flag) with AMD GPU.

Tested also SDL version with same results.

@ocornut
Copy link
Owner

ocornut commented Oct 19, 2021

@BrutPitt

    1. Can you test with the patch linked above ?
    1. Is the total amount mostly stable and independent of time elapsed (e.g. 3 seconds run vs 1 minute run) ?

@BrutPitt
Copy link

  • i. With patch (forked imgui-features-opengl_buffer_update) have same report (with NVIDIA)
  • ii. The report is identical also over 5 minutes of run, and also the allocated system memory is stable

@AMS21
Copy link
Author

AMS21 commented Oct 19, 2021

  • Report with Viewports disables:
=================================================================
==9841==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6280 byte(s) in 3 object(s) allocated from:
    #0 0x7f3fbf453459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f3fb820774b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7f3fbf453652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f3fb82069f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

Indirect leak of 134192 byte(s) in 419 object(s) allocated from:
    #0 0x7f3fbf453459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f3fb820774b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Indirect leak of 4662 byte(s) in 344 object(s) allocated from:
    #0 0x7f3fbf453279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f3fb82072e4  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb2e4)

Indirect leak of 752 byte(s) in 6 object(s) allocated from:
    #0 0x7f3fbf453652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f3fb82069f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

SUMMARY: AddressSanitizer: 146782 byte(s) leaked in 773 allocation(s).
=================================================================
==10700==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6280 byte(s) in 3 object(s) allocated from:
    #0 0x7fcfa98f1459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fcfa270774b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7fcfa98f1652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fcfa27069f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

Indirect leak of 134192 byte(s) in 419 object(s) allocated from:
    #0 0x7fcfa98f1459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fcfa270774b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Indirect leak of 4662 byte(s) in 344 object(s) allocated from:
    #0 0x7fcfa98f1279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fcfa27072e4  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb2e4)

Indirect leak of 752 byte(s) in 6 object(s) allocated from:
    #0 0x7fcfa98f1652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fcfa27069f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

SUMMARY: AddressSanitizer: 146782 byte(s) leaked in 773 allocation(s).
  • No difference if run for a few seconds or several minutes.
  • Same report for example_glfw_opengl2
  • Report for example_glfw_vulkan run witth cmake . -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS="-coverage -fsanitize=address,undefined,float-divide-by-zero -fno-sanitize-recover=undefined -g -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-common" && cmake --build . && ./example_glfw_vulkan:
=================================================================
==14251==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 72704 byte(s) in 1 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d4bdd7c45  (<unknown module>)
    #2 0x7f5d4bdc7152  (<unknown module>)

Direct leak of 6304 byte(s) in 4 object(s) allocated from:
    #0 0x7f5d8228c459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f5d7b2c674b  (/usr/lib/libstdc++.so.6.0.29+0x61274b)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7f5d8228c652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f5d7b2c59f2  (/usr/lib/libstdc++.so.6.0.29+0x6119f2)

Direct leak of 408 byte(s) in 1 object(s) allocated from:
    #0 0x7f5d8228c459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f5d7cdea25c in _XimOpenIM (/usr/lib/../lib/libX11.so.6+0x6825c)

Direct leak of 248 byte(s) in 6 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d4c58f447  (<unknown module>)

Indirect leak of 134192 byte(s) in 419 object(s) allocated from:
    #0 0x7f5d8228c459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f5d7b2c674b  (/usr/lib/libstdc++.so.6.0.29+0x61274b)

Indirect leak of 22787 byte(s) in 112 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d4c58f447  (<unknown module>)

Indirect leak of 4690 byte(s) in 345 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d7b2c62e4  (/usr/lib/libstdc++.so.6.0.29+0x6122e4)

Indirect leak of 3084 byte(s) in 1 object(s) allocated from:
    #0 0x7f5d8228c459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f5d4c3e0f70  (<unknown module>)

Indirect leak of 2911 byte(s) in 99 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d4c3acc57  (<unknown module>)

Indirect leak of 896 byte(s) in 14 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d4c58f447  (<unknown module>)
    #2 0x60300004984f  (<unknown module>)

Indirect leak of 752 byte(s) in 6 object(s) allocated from:
    #0 0x7f5d8228c652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f5d7b2c59f2  (/usr/lib/libstdc++.so.6.0.29+0x6119f2)

Indirect leak of 112 byte(s) in 2 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d4c3db7b9  (<unknown module>)

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d4c58f447  (<unknown module>)
    #2 0x61800005807f  (<unknown module>)

Indirect leak of 64 byte(s) in 1 object(s) allocated from:
    #0 0x7f5d8228c279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f5d4c58f447  (<unknown module>)
    #2 0x20000000f  (<unknown module>)

SUMMARY: AddressSanitizer: 250112 byte(s) leaked in 1013 allocation(s).
  • Report for example_glut_opengl2:
=================================================================
==14808==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6280 byte(s) in 3 object(s) allocated from:
    #0 0x7fc399d85459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fc392e4474b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7fc399d85652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fc392e439f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

Indirect leak of 134192 byte(s) in 419 object(s) allocated from:
    #0 0x7fc399d85459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fc392e4474b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Indirect leak of 4562 byte(s) in 337 object(s) allocated from:
    #0 0x7fc399d85279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fc392e442e4  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb2e4)

Indirect leak of 560 byte(s) in 5 object(s) allocated from:
    #0 0x7fc399d85652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fc392e439f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

SUMMARY: AddressSanitizer: 146490 byte(s) leaked in 765 allocation(s).
  • Report for example_sdl_opengl2:
=================================================================
==15084==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6280 byte(s) in 3 object(s) allocated from:
    #0 0x7fda13cba459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fda0b4b274b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Direct leak of 920 byte(s) in 5 object(s) allocated from:
    #0 0x7fda13cba459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fda0edaaea8  (<unknown module>)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7fda13cba652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fda0b4b19f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

Direct leak of 520 byte(s) in 13 object(s) allocated from:
    #0 0x7fda13cba279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fda0edc5492  (<unknown module>)

Direct leak of 96 byte(s) in 3 object(s) allocated from:
    #0 0x7fda13cba279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fda0edbcca1  (<unknown module>)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7fda13cba459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fda13a55ee1  (/usr/lib/libSDL2-2.0.so.0+0x76ee1)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fda13cba279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fda0edbead2  (<unknown module>)

Indirect leak of 134192 byte(s) in 419 object(s) allocated from:
    #0 0x7fda13cba459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7fda0b4b274b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Indirect leak of 4660 byte(s) in 344 object(s) allocated from:
    #0 0x7fda13cba279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fda0b4b22e4  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb2e4)

Indirect leak of 1757 byte(s) in 8 object(s) allocated from:
    #0 0x7fda13cba652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fda0edbef25  (<unknown module>)

Indirect leak of 752 byte(s) in 6 object(s) allocated from:
    #0 0x7fda13cba652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7fda0b4b19f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

Indirect leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7fda13cba279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fda0edbf144  (<unknown module>)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fda13cba279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fda0edbead2  (<unknown module>)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fda13cba279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7fda0edbeb26  (<unknown module>)

SUMMARY: AddressSanitizer: 150265 byte(s) leaked in 808 allocation(s).
  • Report for example_sdl_opemgl3:
=================================================================
==15341==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6280 byte(s) in 3 object(s) allocated from:
    #0 0x7f855522d459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f854c9b274b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Direct leak of 920 byte(s) in 5 object(s) allocated from:
    #0 0x7f855522d459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f855056eea8  (<unknown module>)

Direct leak of 896 byte(s) in 1 object(s) allocated from:
    #0 0x7f855522d652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f854c9b19f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

Direct leak of 520 byte(s) in 13 object(s) allocated from:
    #0 0x7f855522d279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f8550589492  (<unknown module>)

Direct leak of 96 byte(s) in 3 object(s) allocated from:
    #0 0x7f855522d279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f8550580ca1  (<unknown module>)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f855522d459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f8554fc8ee1  (/usr/lib/libSDL2-2.0.so.0+0x76ee1)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f855522d279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f8550582ad2  (<unknown module>)

Indirect leak of 134192 byte(s) in 419 object(s) allocated from:
    #0 0x7f855522d459 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x7f854c9b274b  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb74b)

Indirect leak of 4660 byte(s) in 344 object(s) allocated from:
    #0 0x7f855522d279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f854c9b22e4  (/usr/lib/libnvidia-glcore.so.470.63.01+0xddb2e4)

Indirect leak of 1757 byte(s) in 8 object(s) allocated from:
    #0 0x7f855522d652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f8550582f25  (<unknown module>)

Indirect leak of 752 byte(s) in 6 object(s) allocated from:
    #0 0x7f855522d652 in __interceptor_realloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:164
    #1 0x7f854c9b19f2  (/usr/lib/libnvidia-glcore.so.470.63.01+0xdda9f2)

Indirect leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7f855522d279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f8550583144  (<unknown module>)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f855522d279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f8550582ad2  (<unknown module>)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f855522d279 in __interceptor_malloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x7f8550582b26  (<unknown module>)

SUMMARY: AddressSanitizer: 150265 byte(s) leaked in 808 allocation(s).

Hope that helps :/

@AMS21 AMS21 changed the title ImGui seems to leaks memory on Linux with glfw + OpenGL3 backend ImGui seems to leaks memory on Linux Oct 19, 2021
@ocornut
Copy link
Owner

ocornut commented Oct 19, 2021 via email

@BrutPitt
Copy link

Just for the sake of completeness, I summarize the results with AMD GPU/drivers :

example_glfw_opengl3

=================================================================
==68062==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6240 byte(s) in 3 object(s) allocated from:
    #0 0x7fa47be3daf7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7fa4691da986 in pb_slabs_init (/usr/lib64/dri/radeonsi_dri.so+0xca6986)

SUMMARY: AddressSanitizer: 6240 byte(s) leaked in 3 allocation(s).

example_glfw_opengl2

=================================================================
==74678==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6240 byte(s) in 3 object(s) allocated from:
    #0 0x7fd266d5caf7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7fd254106986 in pb_slabs_init (/usr/lib64/dri/radeonsi_dri.so+0xca6986)

SUMMARY: AddressSanitizer: 6240 byte(s) leaked in 3 allocation(s).

example_sdl_opengl3

=================================================================
==73666==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6240 byte(s) in 3 object(s) allocated from:
    #0 0x7f14d3db9af7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f14bfc8c986 in pb_slabs_init (/usr/lib64/dri/radeonsi_dri.so+0xca6986)

Direct leak of 736 byte(s) in 4 object(s) allocated from:
    #0 0x7f14d3db9af7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f14cf9b3d3f  (<unknown module>)

Direct leak of 520 byte(s) in 13 object(s) allocated from:
    #0 0x7f14d3db993f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f14cf9c49c5  (<unknown module>)

Direct leak of 184 byte(s) in 1 object(s) allocated from:
    #0 0x7f14d3db9af7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f14cf9b3d3f  (<unknown module>)
    #2 0xd00000004  (<unknown module>)

Direct leak of 96 byte(s) in 3 object(s) allocated from:
    #0 0x7f14d3db993f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f14cf9c1273  (<unknown module>)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f14d3db9af7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f14d3c075ca in SDL_CreateMutex_REAL (/lib64/libSDL2-2.0.so.0+0x1075ca)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f14d3db993f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f14cf9c88bd  (<unknown module>)

Indirect leak of 1845 byte(s) in 8 object(s) allocated from:
    #0 0x7f14d3db9cb8 in __interceptor_realloc (/lib64/libasan.so.6+0xaecb8)
    #1 0x7f14cf9c1d74  (<unknown module>)

Indirect leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7f14d3db993f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f14cf9b3e42  (<unknown module>)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f14d3db993f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f14cf9c88bd  (<unknown module>)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f14d3db993f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f14cf9b909a  (<unknown module>)

SUMMARY: AddressSanitizer: 9813 byte(s) leaked in 38 allocation(s).

example_sdl_opengl2

=================================================================
==74841==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6240 byte(s) in 3 object(s) allocated from:
    #0 0x7f2c16f1caf7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f2c02df0986 in pb_slabs_init (/usr/lib64/dri/radeonsi_dri.so+0xca6986)

Direct leak of 736 byte(s) in 4 object(s) allocated from:
    #0 0x7f2c16f1caf7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f2c12d3bd3f  (/usr/lib64/libasan.so.6.0.0+0x19d3f)

Direct leak of 520 byte(s) in 13 object(s) allocated from:
    #0 0x7f2c16f1c93f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f2c12d4c9c5  (<unknown module>)

Direct leak of 184 byte(s) in 1 object(s) allocated from:
    #0 0x7f2c16f1caf7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f2c12d3bd3f  (/usr/lib64/libasan.so.6.0.0+0x19d3f)
    #2 0xd00000004  (<unknown module>)

Direct leak of 96 byte(s) in 3 object(s) allocated from:
    #0 0x7f2c16f1c93f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f2c12d49273  (<unknown module>)

Direct leak of 40 byte(s) in 1 object(s) allocated from:
    #0 0x7f2c16f1caf7 in calloc (/lib64/libasan.so.6+0xaeaf7)
    #1 0x7f2c16d6a5ca in SDL_CreateMutex_REAL (/lib64/libSDL2-2.0.so.0+0x1075ca)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f2c16f1c93f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f2c12d508bd  (<unknown module>)

Indirect leak of 1845 byte(s) in 8 object(s) allocated from:
    #0 0x7f2c16f1ccb8 in __interceptor_realloc (/lib64/libasan.so.6+0xaecb8)
    #1 0x7f2c12d49d74  (<unknown module>)

Indirect leak of 80 byte(s) in 2 object(s) allocated from:
    #0 0x7f2c16f1c93f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f2c12d3be42  (/usr/lib64/libasan.so.6.0.0+0x19e42)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f2c16f1c93f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f2c12d508bd  (<unknown module>)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f2c16f1c93f in __interceptor_malloc (/lib64/libasan.so.6+0xae93f)
    #1 0x7f2c12d4109a  (<unknown module>)

SUMMARY: AddressSanitizer: 9813 byte(s) leaked in 38 allocation(s).

And ending: no substantial differences with or without Multi-Viewports enabled

@ocornut
Copy link
Owner

ocornut commented Oct 21, 2021

Closing as per #4660 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants