al_free(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ al_free β€” Allegro 5 API ✨

okay bestie, welcome to al_free from the Allegro 5 API πŸ’– this one's a lil macro that frees memory, and honestly it's giving "responsible queen" energy. let's get into it 🫢


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

#define al_free(p) \
   (al_free_with_context((p), __LINE__, __FILE__, __func__))

no cap, that's the whole thing πŸ‘‘ it's a macro, not a real function, so it sneaks in some extra context (your line number, your file, your function name) before handing off to the actual worker.


πŸ’… DESCRIPTION πŸ’…

so basically al_free is like free() from the C standard library… except the implementation may be overridden ✨ that's the whole plot twist. same vibes, but Allegro-friendly.

now here's the part you actually need to remember, bestie, because it WILL bite you:

on Windows, a memory block that was allocated by one DLL has to be freed from the same DLL. periodt. that's just how it is on that platform 😭

so in the few places where an Allegro function hands you back a pointer that you're supposed to free, you must use al_free instead of plain old free() β€” that's what makes your code portable to Windows. do not skip this, fr fr πŸ’€

and just to be super clear one more time: this is a macro. πŸ¦‹

lowkey important: it's a macro, not a function β€” so don't go taking its address or doing weird function-pointer shenanigans with it πŸ™ˆ

πŸŽ€ SEE ALSO πŸŽ€


that's the page, bestie! this was al_free(3alleg5) straight out of the Allegro reference manual πŸ§šπŸ’œ go forth and free your memory responsibly, you main character 🫢✨

πŸ“¦ where this page comes from