#3721·SFML

`sf::RenderWindow` stops MSVC `_CRTDBG_LEAK_CHECK_DF` from reporting leaks

Author: fortsnek9348Created May 29, 2026Updated May 29, 2026
Labelsbug

Prerequisite Checklist

Describe your issue here

Of course, I want to check for leaks in my program. But it seems I can't simply because I'm using SFML.

Bit of an odd issue. No idea what causes it. But hopefully, it's not just some odd thing on my end.

It is specifically creating a window. Calling some other function like sf::sleep does not trigger the bug.

I have also tested a raw Win32 OpenGL example, and that doesn't trigger the bug either.

And I've searched SFML's sources and didn't find anything relevant.

Your Environment

VS 18.6.0, Windows 10, SFML 3.1.0 x64 debug DLL

Steps to reproduce

Compile and run the following program, and look at the debug output window in VS:

cpp
#include <SFML/Graphics.hpp>

#include <crtdbg.h>

int main()
{
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	(void)new int;
	sf::RenderWindow window(sf::VideoMode({ 1024, 768 }), "Hiss");
	return 0;
}

Using libs: sfml-system-d.lib, sfml-window-d.lib, sfml-graphics-d.lib

Expected behavior

Detected memory leaks!
Dumping objects ->
{8245} normal block at 0x000002190AAFFAC0, 4 bytes long.
 Data: <    > CD CD CD CD 
Object dump complete.
The program '[33144] ZTest_x64_Debug.exe' has exited with code 0 (0x0).

Actual behavior

The program '[26428] ZTest_x64_Debug.exe' has exited with code 0 (0x0).