Recently, I am getting some OutOfMemory errors. Is it possible to detect in advance when the virtual machine is still working on memory? In other words, to proactively deal with OutOfMemory errors before they actually happen?
Java (starting with Java 5) now has a standard JMX bean that can be used to receive low memory notifications. See java.lang.management.MemoryMXBean.
java.lang.management.MemoryMXBean
I suggest that the best question is: "Why does my application run out of memory?"
, , JVM ; (, , .)
/, , .
Take a look at the freeMemory Runtime method (see http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html for details)
In short: do
Runtime.getRuntime().freeMemory()
Source: https://habr.com/ru/post/1698700/More articles:What is the lightest Java virtual machine? (except KVM) - javaSearch for a template / approach / suggestion for working with long-term work tied to a web application - performanceCSS and Safari / Chrome - cssRemoving elements from an IDictionary with recursion - c #Resources to get started with MCML? - .netConfiguring EasyPHP to use CGI - configIs there a compressed directory of naming variables? - variableshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1698703/documentimage-database-repository-design-question&usg=ALkJrhiUcBut_Akg35Bv_beUPg8VnaRiogWhat online collaboration sites do you know? - project-managementRows in their own columns depending on their value - sqlAll Articles