ZGC runs not often enough. GC logs show that it runs once every 2-3 minutes for my application and because of this, my memory usage goes high between GC cycles (as high as 90%). After GC, it drops to as low as 20%. How to increase GC run’s frequency to run more often? Answer -XX:ZCollectionInterval=N – set maximum gap between
Tag: garbage-collection
Java object garbage collection
I am working on the OCA Java certification and unsure of how to understand the answer to one question. The question is which object will be available for garbage collection after the //HERE point. The answer provided by the online test is : One object (o1). Can someone explain me why? Answer Consider a simple class Student. Step 1 :
How to assert some Java method is garbage free?
I have a piece of code that (currently) use Java 8’s Optional and Stream. And we started having GC overhead issues since this code was deployed to production. See the gist of the code below (getters, constructors and overloads removed for clarity): While it could be unrelated, I’d like to make this code garbage free, especially since it’s a code
Object lifecycle and GC in case of Composition
Below is an example of Composition: What I learned is that as soon as object of A3 is GC’ed (or becomes eligible for GC), object of B will also be GC’ed (or becomes eligible for GC). Now, let’s consider below situation, so as per my understanding after d.m1();, a3 object on heap will become eligible for GC, but I don’t
Where is the “age threshold” for the referenced object stored in Garbage Collection process stored?
I am trying to understand how GC works and have been reading https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html Garbage Collection Process, point #6 says, “After a minor GC, when aged objects reach a certain age threshold (8 in this example) they are promoted from young generation to old generation.” I am trying to understand where the “age threshold” for the referenced object stored? Answer This
What does “Other” mean in Java GC log?
I have such setup Java 11 Corretto inside Docker running on EC2 Java options: -Xms1200m -Xmx1200m -XX:+UseG1GC -Xlog:gc* In log I see that usually GC takes ~100-200ms, but for some timeslots, I see some weird behavior: [2074.114s][info][gc,phases ] GC(39) Other: 4082.5ms What does this “other” step mean? Answer This is most likely due to time spent writing the log out
In java, is there a way to examine how an object is still reachable from garbage collection root?
The codebase is somewhat complex, so I was wondering if there was a tool to examine an object at runtime and determine how the JVM still sees this object as reachable. In particular, there’s one object type that I would only expect to be one instance of at a time throughout the life of the app (new ones can be
why my JVM did 3 times of FullGC when it started
My job is a Flink TaskManager job. When it starts, it starts 3 times of GC. I don’t know why when it reached the MetadataGCThreshold it increased Tenured Space, while Metaspace didn’t change, and even increased between GCs. I thought FullGC would decrease Tenured Space, and some space of Metaspace. 😯 ================================================================= FollowUP thanks to Stephen’s answer, I set the
Heap allocation source code in in jdk(G1GC) [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations. Closed 2 years ago. Improve this question I want to understand how java allocates objects in heap. I
The cause of blocking GC Allocation problem when starting an Android application
I have recently encountered an unusual problem with Garbage Collecter allocation when beginning my application from Android Studio. My code compiles without errors and the program doesn’t throw any exceptions on Runtime. Nevertheless, when I start my program, it doesn’t respond. My Logcat shows: Then such logs appear repeatedly, till the program stops responding completely. As I read here and