After reading article Detecting Java OutOfMemoryError before it happens we have decided to implement such a out of memory detection in our project. Unfortunately with G1 GC