Memory leaks on master with simple app not doing anything #5759
Closed
Description
This simple sample with latest master from git is causing 5 allocations to keep hanging.
Am I missing some free I should have done? I think I did not left anything for simple sample 🤔
I am on Windows 11, using Visual Studio 22 if it makes any difference.
Just this sample is causing mentioned issue, no other code is anywhere inbetween in the main itself.
SDLMAIN_DECLSPEC int SDL_main(int argc, char* argv[])
{
const auto init_allocations = SDL_GetNumAllocations(); // NOTE: always seems to be 0 at this point, but leaving it for good measure...
// Setup SDL
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0)
{
printf("Error: %s\n", SDL_GetError());
return -1;
}
// Setup window
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI);
SDL_Window* window = SDL_CreateWindow("SDL2 Example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags);
// Main loop
bool done = false;
while (!done)
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
if (event.type == SDL_QUIT)
done = true;
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(window))
done = true;
}
}
SDL_DestroyWindow(window);
SDL_Quit();
SDL_assert(init_allocations == SDL_GetNumAllocations()); // ERROR: assertion fails, as there seem to be 5 allocations performed inside some of these functions that do not get freed
return 0;
}