"Fossies" - the Fresh Open Source Software Archive

Member "SAOImageDS9/xpa/doc/oom.html" (13 Nov 2019, 1352 Bytes) of package /linux/misc/ds9.8.1.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the ds9.8.1.tar.gz project site itself.

Xpaoom: What happens when XPA runs out of memory?

Summary

When XPA can't allocate memory, it exits. You can arrange to have it call longjmp() instead.

Description

When an XPA server or client cannot allocate memory, it will attempt to output an error message and then exit. If this is not satisfactory (e.g., perhaps your program is interactive and can recover from OOM errors), you can tell XPA to call longjmp() to go to a recovery branch. 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 ...

Go to XPA Help Index

Last updated: April 7, 2009