Closed gresskar closed 5 months ago
There's still a memory leak when I cut out most code, but it's a couple KB smaller:
#include <stdlib.h>
#include <SDL3/SDL.h>
int main(void)
{
/* Initialize video subsystem */
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0)
{
SDL_Log("SDL_InitSubSystem(): %s", SDL_GetError());
return EXIT_FAILURE;
}
/* Clean up & exit */
SDL_QuitSubSystem(SDL_INIT_VIDEO);
SDL_Quit();
return EXIT_SUCCESS;
}
=================================================================
==30384==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 736 byte(s) in 4 object(s) allocated from:
#0 0x58e471109611 in calloc (/home/user/test/bin/main+0x11a611) (BuildId: 10777af3fb27884c534365126f854c135f64c827)
#1 0x7ac3a87b2d8a (<unknown module>)
Direct leak of 520 byte(s) in 13 object(s) allocated from:
#0 0x58e4711092a9 in malloc (/home/user/test/bin/main+0x11a2a9) (BuildId: 10777af3fb27884c534365126f854c135f64c827)
#1 0x7ac3a87c4248 (<unknown module>)
Direct leak of 184 byte(s) in 1 object(s) allocated from:
#0 0x58e471109611 in calloc (/home/user/test/bin/main+0x11a611) (BuildId: 10777af3fb27884c534365126f854c135f64c827)
#1 0x7ac3a87b2d8a (<unknown module>)
#2 0x2a00000021 (<unknown module>)
Direct leak of 96 byte(s) in 3 object(s) allocated from:
#0 0x58e4711092a9 in malloc (/home/user/test/bin/main+0x11a2a9) (BuildId: 10777af3fb27884c534365126f854c135f64c827)
#1 0x7ac3a87c0954 (<unknown module>)
Direct leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x58e4711092a9 in malloc (/home/user/test/bin/main+0x11a2a9) (BuildId: 10777af3fb27884c534365126f854c135f64c827)
#1 0x7ac3a87c835f (<unknown module>)
Indirect leak of 1184 byte(s) in 4 object(s) allocated from:
#0 0x58e4711083ba in realloc.part.0 asan_malloc_linux.cpp.o
#1 0x7ac3a87c18cc (<unknown module>)
Indirect leak of 1060 byte(s) in 5 object(s) allocated from:
#0 0x58e4711083ba in realloc.part.0 asan_malloc_linux.cpp.o
#1 0x7ac3a87c0a4f (<unknown module>)
Indirect leak of 40 byte(s) in 1 object(s) allocated from:
#0 0x58e4711092a9 in malloc (/home/user/test/bin/main+0x11a2a9) (BuildId: 10777af3fb27884c534365126f854c135f64c827)
#1 0x7ac3a87c1288 (<unknown module>)
Indirect leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x58e4711092a9 in malloc (/home/user/test/bin/main+0x11a2a9) (BuildId: 10777af3fb27884c534365126f854c135f64c827)
#1 0x7ac3a87c835f (<unknown module>)
Indirect leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x58e4711092a9 in malloc (/home/user/test/bin/main+0x11a2a9) (BuildId: 10777af3fb27884c534365126f854c135f64c827)
#1 0x7ac3a87b887c (<unknown module>)
SUMMARY: AddressSanitizer: 3892 byte(s) leaked in 34 allocation(s).
Generally, these are leaks in OpenGL's initialization code, not SDL.
(And D-bus.)
Some info:
SDL_VIDEODRIVER
set to bothwayland
andx11
I have a small skeleton program I compile with:
clang -std=c99 -fsanitize=address -I /usr/local/include -L /usr/local/lib -l SDL3 src/main.c -o bin/main
:ASan output