SDL_aligned_free(3)

πŸ’– SDL_aligned_free(3) β€” the "okay bestie, we're done here" of memory management πŸ’–

So you grabbed a chunk of memory with SDL_aligned_alloc() and now you're like... girl, what do I even do with this? Say less. This is the SDL3 function that hands it back. It lives in the SDL3 FUNCTIONS fam, and it's giving very much "cleanup era." 🧹✨


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

void SDL_aligned_free(void *mem);

🌸 DESCRIPTION 🌸

Okay so. Once you call this, that pointer is done. Like, no longer valid. Cannot be dereferenced anymore. Not even a little. Don't look at it, don't touch it, don't be like "but what if I justβ€”" no. It's gone, the vibes are gone, move on. πŸ’€

But also, plot twist that's actually very chill of it: if mem is NULL, this function does nothing. No crash, no drama, just a peaceful little no-op. Iconic behaviour honestly. 🫢


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • mem β€” a pointer that was previously returned by SDL_aligned_alloc(), or NULL. That's it, that's the whole vibe check. 🌈

πŸ¦‹ THREAD SAFETY πŸ¦‹

Bestie you can call this from any thread. Every single one. Go feral. It's safe. πŸ’…


⭐ AVAILABILITY ⭐

This function has been available since SDL 3.2.0. So if you're on something older, respectfully, it's not there yet. πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

  • SDL_aligned_alloc(3) β€” the one that gave you the memory in the first place. The origin story. The main character. Go read it. πŸ“–

Simple Directmedia Layer Β· SDL 3.4.18 β€” that's the version tag, and it's serving. This page was brought to you by the SDL3 functions crew, and honestly? Freeing memory has never been this cute. Slay, free your pointers, hydrate, and go to bed. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from