Recovering From Out of Memory Exceptions

This topic describes what happens when GemFire XD runs out of memory.

Since you can store your GemFire XD tables in the Java heap or in off-heap memory, there are two distinct situations where you can run out of memory:
  • Java heap runs out of memory. When the Java heap runs out of memory, threads start throwing an OutOfMemoryError
  • System runs out of off-heap memory. In this case, threads start throwing OutOfOffHeapMemoryException

In either case, when threads being throwing out of memory exceptions, GemFire XD closes the cache and disconnects from the distributed system to prevent reading inconsistent data. If your Java heap runs out of memory, you will need to kill and restart your JVM. Any applications or frameworks relying on the JVM must also be shut down and restarted.

If you run out of off-heap memory, you may be able to reuse the existing JVM; however, if you need to modify the configuration of your GemFire XD system, you may need to restart the JVM.

When your run into out of memory exceptions, Pivotal recommends that you:
  • Check your configuration. You may need to allocate additional heap (using -heap-size) and/or off-heap memory (using -off-heap-size) when starting up your data stores. See server for more information on these command line options.
  • Analyze your data. You can view the memory usage for specific tables by querying the SYS.MEMORYANALYTICS table. See Viewing Memory Usage in SYS.MEMORYANALYTICS.
Note: To help prevent out of memory errors, you can also configure GemFire XD to either evict data from its tables when memory usage hits a certain level or to throw LowMemoryExceptions first by setting the critical-heap-percentage or critical-off-heap-percentage thresholds when either starting your data stores or by using built-in system procedures. See Procedures.