I'm using PySDL2 and while reading the examples, I noticed that the examples call sdl2.SDL_FreeSurface(image)
. I am wondering, if I don't use FreeSurface, does that create a memory leak? Doesn't the garbage collection handle this?
It creates a memory leak, if the surface is not managed by some high-level wrapper (e.g. the SoftwareSprite/TextureSprite objects found in the pysdl2.ext package http://pysdl2.readthedocs.org/en/latest/modules/sdl2ext_sprite.html).
The SDL2 functions and structures of PySDL2 are plain 1:1 wrappers to the C library, so there is no automated garbage collection.