xpaoom(n)
π 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 saysetjmp(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
- fedora 43: xpa-devel 2.1.20-9.fc43 Β· MIT
- fedora 43: xpa-devel 2.1.20-9.fc43 Β· MIT
- fedora 44: xpa-devel 2.1.20-10.fc44 Β· MIT
- fedora 44: xpa-devel 2.1.20-10.fc44 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms