I am testing the new zgc garbage collector that was included in java 11 since it promises really low latency. Our application is a real-time service that creates and destroys many objects per second and it does it in a multi-threaded environment using akka. When enabling zgc by passing the options -XX:+UnlockExperimentalVMOptions -XX:+UseZGC and enabling gc logs, we can see
Tag: garbage-collection
How to properly set the G1GC options for a server with 22G heap
I’m setting up a new JAVA server, the heap size is set to 22G, and would use the G1GC algorithm. I’ve read all the oracle documents, and believe this is what we need, but still have a few questions: 1> What -XX:G1HeapRegionSize should be ? Must the number be a power of two? If so, should I set 8M to
Why is SerialGC chosen over G1GC?
I am running Java on very similar VMs and I can’t find the explanation why the SerialGC is chosen over G1GC in one case. It’s the same Java version, same OS, same VM instance type on AWS, and I suspect the only difference is container settings but I do not know how to pinpoint what changes. Is there a way
Garbage Collector not freeing “trash memory” as it should in an Android application
Hello! I’m a beginner Java and Android developer and I’ve been having trouble lately dealing with my app’s memory management. I will break this text into sections, in order to make it clearer and readable. A brief description of my app It’s a game that consists of several stages (levels). Each stage has a starting point for the player and
Minor GC pause times are too higfh. possible reasons?
I Am experiencing a regular high minor GC pause times(~ 9seconds). The application is a server written in Java, executing 3 transactions/seconds. Eventhough there’s no I/O excessive activity Heap parameters are: What are the possible reasons for such minor gc pause times values? Answer As the other answer says, without GC log snippets it’s not possible to answer this definitively.
Are lambdas garbage collected?
If I’m not mistaken, under certain situations a lambda in Java is generated as an anonymous class instance. For example, in this code the lambda needs to capture a variable from the outside: Does it means that the garbage collector will claim the lambda as an object? Answer No it won’t; this is not how lambdas work. Yes, a class
Can heap dump be created for analyzing memory leak without garbage collection?
We have some memory leak issues on VMs in production which are running Java applications, the Old Gen heap usage grows fast every day, so I want to create heap dump to analyze it. However, I noticed that VisualVM will perform full GC before heap dump which will clean the Old Gen, in that case, the heap dump would be
Need an explanation for apparent heap size reduction
From the GC logs, it appears that the heap size is being reduced across young and old generations after sometime. Below are three entries from the logs. {Heap before gc invocations=5: PSYoungGen total 44800K, used 44180K [0x18220000, 0x1b420000, 0x24a20000) eden space 38400K, 100% used [0x18220000,0x1a7a0000,0x1a7a0000) from space 6400K, 90% used [0x1ade0000,0x1b3853c8,0x1b420000) to space 6400K, 0% used [0x1a7a0000,0x1a7a0000,0x1ade0000) PSOldGen total 51200K,
Can the OS stop a Java process from garbage collecting?
I’m monitoring a production system with AppDynamics and we just had the system slow to a crawl and almost freeze up. Just prior to this event, AppDynamics is showing all GC activity (minor and major alike) flatline for several minutes…and then come back to life. Even during periods of ultra low load on the system, we still see our JVMs
Measuring time spent on GC
Suppose I am testing a Java server application. I know how much time it takes to finish the test. Now I’d like to know how much was spent on GC during that test. How can I do it? Answer The simplest way is to use the -Xloggc and -XX:-PrintGCTimeStamps options when starting up your JVM. I think it prints out