Do something before running out of memory

Is there a way in Java to do something before running out of memory. For example, keeping a list of previous document states (for cancellation) and deleting only very old states when the memory is about to be exhausted?

+5
source share
2 answers

For example, keeping a list of previous document states (for cancellation) and deleting only very old states when the memory is about to be exhausted?

, - SoftReference. java.lang.ref. SoftReference, . , , - , . - .

+2

, .

, , SoftReference . .

.

, : -)

JVM, , JVM . JVM, .

+1

All Articles