xpaoom(n)

πŸ“¦ version 2.1.20, in fedora 43, fedora 44

πŸ’– xpaoom(n) β€” the "bestie, we're out of memory" page πŸ’–

SAORD Documentation ✨ XPAoom ✨

okay so real talk: this is the page in the xpa(n) family that tells you what goes down when XPA runs out of memory. it's short, it's sweet, it's lowkey the most dramatic page in the whole set. let's get into it 🫢


🌸 NAME 🌸

Xpaoom β€” what happens when XPA runs out of memory? 😭


✨ SYNOPSIS ✨

okay so the whole tea is: when XPA can't allocate memory, it exits. periodt. but you can arrange to have it call longjmp() instead, if you're built different. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the situation, bestie. when an XPA server or client cannot allocate memory, it will attempt to output an error message and then exit. like, that's it, that's the whole thing, it's over for you.

but wait β€” if that's not satisfactory (e.g., maybe your program is interactive and can actually recover from OOM errors, main character energy ✨), you can tell XPA to call longjmp() to go to a recovery branch instead. not me setting up a lil escape hatch 😌

to pass the requisite jmp_buf variable to XPA, make the following call:

XPASaveJmp(void *env);

the value of env is the address of a jmp_buf variable that was previously passed to setjmp(). for example:

jmp_buf env;
...
if( setjmp(jmp_buf) != 0 ){
  /* out of memory -- take corrective action, if possible */
} else {
  /* save env for XPA */
  XPASaveJmp((void *)&jmp_buf);
}
// enter main loop ...
πŸ’€ quick heads up: those examples are copied verbatim from the page, so yes, they literally say setjmp(jmp_buf) and &jmp_buf β€” write them exactly as they appear, don't get cute and "fix" them.

it's giving "plan for the worst, hope for the best" and honestly? iconic. πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

see xpa(n) for a list of XPA help pages 🫢


version 2.1.15 🌈 July 23, 2013 β€” that's the source/version and the date, babes, and that's a wrap on xpaoom(n) πŸŽ€ stay hydrated, free your memory, and remember: when the malloc fails, know where you're longjmp-ing to πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from