garbage-collection

Java 7 G1GC strange behaviour

旧时模样 提交于 2020-02-04 01:25:15
问题 Recently I have tried to use G1GC from jdk1.7.0-17 in my java processor which is processing a lot of similar messages received from an MQ (about 15-20 req/sec). Every message is processed in the separate thread (about 100 threads in stable state) that serviced by Java limited thread pool. Surprisingly, I detected the strange behaviour - as soon as GC starts the full gc cycle it begins to use significant processing time (up to 100% CPU and even more). I was doing refactoring of the code

Java 7 G1GC strange behaviour

荒凉一梦 提交于 2020-02-04 01:25:12
问题 Recently I have tried to use G1GC from jdk1.7.0-17 in my java processor which is processing a lot of similar messages received from an MQ (about 15-20 req/sec). Every message is processed in the separate thread (about 100 threads in stable state) that serviced by Java limited thread pool. Surprisingly, I detected the strange behaviour - as soon as GC starts the full gc cycle it begins to use significant processing time (up to 100% CPU and even more). I was doing refactoring of the code

Can garbage collection happen while the main thread is busy?

南楼画角 提交于 2020-02-03 10:14:07
问题 Let's say I have a long running loop: // Let's say this loop takes 10 seconds to execute for(let i = 0; i <= 1000000; ++i) { const garbage = { i }; // some other code } Can the garbage collector run during the loop, or it can only run when the application is idle? I didn't find any documentation related to this, but because Node.js has the --nouse-idle-notification which in theory disables GC, makes me think that the GC only runs when the idle notification is sent (when the main thread is not

Java String Memory Leak

Deadly 提交于 2020-02-03 04:46:32
问题 I am not java expert. My code is reading a file into a String . This code gets executed every 5 minutes. The size of file varies. Sometimes it is 100 sometimes it is 1000 lines. I am experience Out Of Memory, after some days. The question I have is, when my codes goes out of scope of the Reading file function , does Java garbage collect the String? I am pretty confused by reading on the internet. Some people says it does not get deleted and use StringBuffer . // Demonstrate FileReader. import

When the garbage collector eliminates the object, where does that object go?

房东的猫 提交于 2020-02-02 12:56:53
问题 Let's say garbage collector has identified an instance of a class (an object) - which is not being used by the Java Program. So the Garbage Collector decides to eliminate that object since it is not being used anywhere in the code. Now, when the elimination of an object happens, where does the object go inside the memory? What actually happens to that object inside the memory? In general term - when the object is eliminated - how the computer handles the elimination? how the elimination works

Show the default value chosen for XX:ParallelGCThreads [duplicate]

自古美人都是妖i 提交于 2020-01-29 12:49:30
问题 This question already has an answer here : How do i know which default settings are enabled for Sun JVM? (1 answer) Closed 2 years ago . I'm tuning the JVM of Java 8 and I'm trying to know what the value was defined for the parameter -XX:ParallelGCThreads . The documentation says: -XX:ParallelGCThreads : Sets the number of threads used during parallel phases of the garbage collectors. The default value varies with the platform on which the JVM is running. I would like to know what value was

Show the default value chosen for XX:ParallelGCThreads [duplicate]

僤鯓⒐⒋嵵緔 提交于 2020-01-29 12:49:06
问题 This question already has an answer here : How do i know which default settings are enabled for Sun JVM? (1 answer) Closed 2 years ago . I'm tuning the JVM of Java 8 and I'm trying to know what the value was defined for the parameter -XX:ParallelGCThreads . The documentation says: -XX:ParallelGCThreads : Sets the number of threads used during parallel phases of the garbage collectors. The default value varies with the platform on which the JVM is running. I would like to know what value was

ActionScript - Difference Between Primitive / Non-Primitive Objects for Memory Management?

寵の児 提交于 2020-01-27 20:59:48
问题 my understanding is that primitive types ( uint, string, Number, etc. ) of a class do not need to be set to null for garbage collection. for example, i am not required to write this dispose() method in the following class: package { //Imports import flash.display.Shape; //Class public class DrawSquare extends Shape { //Properties private var squareColorProperty:uint; //Constructor public function DrawSquare(squareColor:uint) { squareColorProperty = squareColor; init(); } //Initialize private

ActionScript - Difference Between Primitive / Non-Primitive Objects for Memory Management?

夙愿已清 提交于 2020-01-27 20:59:27
问题 my understanding is that primitive types ( uint, string, Number, etc. ) of a class do not need to be set to null for garbage collection. for example, i am not required to write this dispose() method in the following class: package { //Imports import flash.display.Shape; //Class public class DrawSquare extends Shape { //Properties private var squareColorProperty:uint; //Constructor public function DrawSquare(squareColor:uint) { squareColorProperty = squareColor; init(); } //Initialize private

ActionScript - Difference Between Primitive / Non-Primitive Objects for Memory Management?

寵の児 提交于 2020-01-27 20:59:05
问题 my understanding is that primitive types ( uint, string, Number, etc. ) of a class do not need to be set to null for garbage collection. for example, i am not required to write this dispose() method in the following class: package { //Imports import flash.display.Shape; //Class public class DrawSquare extends Shape { //Properties private var squareColorProperty:uint; //Constructor public function DrawSquare(squareColor:uint) { squareColorProperty = squareColor; init(); } //Initialize private