System Out of Memory Dialog Box

As discussed in the previous section, the operating system displays a System Out of Memory dialog box in some low-memory scenarios. This dialog box informs the user that memory is critically low on the H/PC and prompts the user either to close applications or to increase the amount of RAM allocated to program memory. This dialog box is a special, system modal dialog box that freezes the rest of the system. When it is invoked, socket connections stop functioning and other threads stop running.

After the System Out of Memory dialog box closes, any applications selected by the user are shut down just as if the Close button was clicked. Applications have eight seconds to close. If more memory is requested after four seconds have passed and memory is still critically low, the dialog box reappears.

Note The success of an approach that sends the WM_CLOSE messages when memory is low depends on the ability of an application to shut down in response while allocating little additional memory in the process. If your application requires a significant amount of memory to shutdown, try caching the needed memory. For example, you could hide a Do You Want to Save Your Document dialog box, and then make it visible if you need to close the application unexpectedly.