Skip to content
Advertisement

Tag: garbage-collection

Getting ‘allocation stall’ when enabling ZGC

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

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

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

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,

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

Advertisement