SDL_FreeSurface(3)
β¨ NAME β¨
SDL_FreeSurface β bestie, this one frees (aka deletes) a SDL_Surface π
It's from the SDL API Reference manual, page SDL_FreeSurface(3), and it's literally the little cleanup queen you call when you're done with a surface. Obsessed. π
πΈ SYNOPSIS πΈ
#include "SDL.h"
void SDL_FreeSurface(SDL_Surface *surface);
That's it. One function, one pointer, zero drama. π¦
π DESCRIPTION π
So like, SDL_FreeSurface frees the resources used by a previously created SDL_Surface. You made a surface, you had your moment, now you release it back into the wild. Main character exit. π
β οΈ BUT β important plot twist β if the surface was created usingSDL_CreateRGBSurfaceFrom, then the pixel data is not freed. Not me warning you so you don't leak your own pixels bestie πSDL_CreateRGBSurfaceFromis the one that doesn't own its pixels, soSDL_FreeSurfaceis not gonna touch them. No cap.
π SEE ALSO π
SDL_CreateRGBSurfaceβ the icon that makes surfaces the normal waySDL_CreateRGBSurfaceFromβ the one that borrows your pixels (and that's why they don't get freed here π«Ά)
Okay that's the whole page, you ate it, go free your surfaces responsibly β¨π
SDL, Tue 11 Sep 2001, 23:01 β from the SDL_FreeSurface(3) era, still slaying, bye bestie πππ¦
π¦ where this page comes from
- debian bookworm: libsdl1.2-dev 1.2.15+dfsg2-8 Β· LGPL-2.1-or-later
- nixos 26.05: SDL_sixel 0-unstable-2016-02-06
- nixpkgs unstable: SDL_sixel 0-unstable-2016-02-06
- ubuntu jammy: libsdl1.2-dev 1.2.15+dfsg2-6 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms