NET_UnrefAddress(3)
π NET_UnrefAddress β from the SDL_net3 functions era π
okay bestie, we're doing a man 3 page today, and this one is short but she MATTERS. it's giving memory management, it's giving "please let go of your ex," it's giving NET_UnrefAddress. let's get into it π«Ά
β¨ NAME β¨
NET_UnrefAddress β drop a reference to an NET_Address. that's it. that's the whole job. she's a one-task queen and she ate π
πΈ SYNOPSIS πΈ
#include <SDL3_net/SDL_net.h>
void NET_UnrefAddress(NET_Address *address);
no return value, no drama, just vibes π
π¦ DESCRIPTION π¦
so here's the tea, and it's actually really good tea: several different pieces of the library might be sharing ONE single NET_Address at the same time. yes, even a background thread that's out there working on resolving. that's a lot of hands on one little object π
which means these objects are reference counted. the whole point is that everybody who's using the address can declare that they still want it, and then drop their reference when they're done with it. and when the very last reference gets dropped? the object's resources are freed. gone. deleted. she's free ποΈ
this function does exactly one thing: it drops a reference to an NET_Address, decreasing its reference count by one. no cap.
β οΈ the docs will always tell you when the app has to explicitly unref an address, so keep an eye out. for example, NET_ResolveHostname() creates addresses that are already referenced, which means the caller needs to unref it when they're done. don't forget, or that memory is just sitting there forever like an unread group chat π
π FUNCTION PARAMETERS π
addressβ theNET_Addressyou're dropping a reference to. the one you're saying bye to π₯²
π₯ THREAD SAFETY π₯
it is safe to call this function from any thread. literally any of them. go wild, bestie β¨
π AVAILABILITY π
this function is available since SDL_net 3.0.0. ancient by internet standards, iconic forever π
and that's the whole page, you're a reference-counting genius now, i'm so proud of you, no notes πβ¨π
this has been brought to you by SDL_net 3.2.0 β the SDL_net crew, still out here unref'ing addresses so your app doesn't leak. mwah π«Ά
π¦ where this page comes from
- fedora 43: SDL3_net-devel 3.2.0-2.fc43 Β· Zlib
- fedora 43: SDL3_net-devel 3.2.0-2.fc43 Β· Zlib
- fedora 44: SDL3_net-devel 3.2.0-2.fc44 Β· Zlib
- fedora 44: SDL3_net-devel 3.2.0-2.fc44 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms