Will the Java garbage collector interrupt the thread?

Something is interrupting threads in my application. This seems to happen when the JVM is close to exiting the heap. I can configure an extra heap for the JVM, but I'm curious if the garbage collector interrupts threads trying to recover memory. Somebody knows? I am using the 64-bit version of Java 1.6.0_16 on RedHat ES 5.2.

Thanks,

John

+4
source share
3 answers

Interruption as in throwing InterruptedException ? No, this should not be. You may need to pause the thread itself, but this is not the same. If the virtual machine OutOfMemoryError out of memory, it should throw an OutOfMemoryError instead ...

+11
source

If OutOfMemory does not occur, streams are not interrupted if garbage collection occurs. They may be on hold for some time.

+2
source

You can receive so-called false interruptions . They can happen at any time, but a low memory / high load situation may make them more likely. However, this will depend on the details of the JVM implementation, this is not the rule, and the correlation with garbage collection (if one exists) is random, and not by design.

0
source

Source: https://habr.com/ru/post/1303707/


All Articles