What else do I need to do to free memory?

The following produces a memory leak in SDL2:

#include <SDL2/SDL.h>
#include <SDL2/SDL_events.h>

int main(int argc, char *argv[]) {

	if (SDL_Init(SDL_INIT_VIDEO) < 0) {
		printf("Couldn't initialize SDL: %s\n", SDL_GetError());
		exit(1);
	}

    SDL_Quit();
	return 0;
}

Is this still a known issue? I’ve seen some other posts from years ago that report memory issues.

How are you detecting the “memory leak”? Your code terminates the process (return 0;) so any memory used will be automatically freed by the OS at that point. I don’t think that should qualify as a ‘leak’.

This is what Microsoft blogger Raymond Chen has to say on the subject of freeing memory on process termination: “All this anal-retentive memory management is pointless. The process is exiting. All that memory will be freed when the address space is destroyed. Stop wasting time and just exit already”.

I’m running it via valgrind. This isn’t an issue on a technical level perhps, since it will be freed by the OS, but having unfreed memory as part of SDL2 makes it difficult to detect when code I’m writing has memory issues.