One strategy for such mission-critical apps would be to grab a sizable
chunk of memory at initialization time as your emergency "cushion". Then
install a signal handler for SEGV which:
- releases the cushion, curing the memory shortage for the short term
- shuts down your app
or
- sends your app into a special emergency shutdown which performs
any cleanup routines using the memory inside your cushion
The first plan has the disadvantage that other processes may steal the
released cushion memory, leaving you without enough to clean up with.
Vance
PS - Of course, holding a large chunk of memory for the lifetime of the
process without ever using it is exactly the kind of thing that would
result in an overcommitted memory situation in the first place ;-)
------------
Vance Huntley
Director of Technology (& Chat Guy)
WebGenesis, Inc., Ithaca, NY 14850
vance@webgenesis.com --- 607.255.8499
Check out "The Globe"! --- http://www.theglobe.com/
------------