I have a java app running in a docker with flags on OpenJDK8: and I’ve noticed that Code Cache memory allocation reported by Native Memory Tracking tool exceeds 240MB (default ReservedCodeCacheSize value): which is ~ 254MB reserved memory. Here’s printed flag and java version: My question is if this is expected behavior? If yes, then is it possible to calculate
Tag: jvm
JVM Getting the largest objects in the heap programmatically
How programmatically (from within the java application/agent) do I get a “live” summary of the largest objects in the heap (including their instances count and size)? Similarly to what Profilers do. For example, here is a screenshot from JProfiler: Usually I used to work with heap dumps in the cases where I really needed that, but now I would like
Profiled application started too soon
When I try to perform the application startup profiling getting Profiled application started too soon have attached error message screenshot below. This warning shows after I forcibly killed a previously profiled application. Have restarted my system but still shows that warning. Thanks in advance. Answer After analysing the visualvm source code, there is a file (${user.home}/.nbprofiler/5140) which will be create
Implementation of invokevirtual in JVM
I had expected that the Java Virtual Machine would use a simple lookup table for normal method invocations: The object contains a pointer to a lookup table with the addresses for all methods that the class implements (including the methods implemented by super-classes). A specific method is simply represented by an index into that table. The JVM looks up the
Setting/changing default Java MaxHeapSize or changing default JVM command settings
I’m using a python script that calls the jvm. Unfortunately, the script doesn’t allow me to pass arguments to the jvm command, so I can’t bump up the max heap size via the Xmx flags. Is there a way to set/change the default MaxHeapSize allowed or set/change default arguments for any jvm calls? JAVA_TOOL_OPTIONS from the answer below worked for
Memory Leak Example -references and objects [closed]
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed 2 years ago. Improve this question I have the below method.Suppose i call A.m1() 10,000 times from class B.
How Kotlin coroutines will use Project Loom? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 2 years ago. Improve this question Right now, Kotlin coroutines are implemented without help of JVM. It does not use something like green (virtual) threads. You can
Java memory leak with a data source
I have heard many times that not closing database connections might lead to a memory leak. (For example in this article) I tried reproducing the same issue by getting a connection from org.apache.commons.dbcp2.BasicDataSource and not closing it. This is my code: I have repeated the same process almost 400 times and also decreased the initial and max heap sizes. Still,
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
Why Kotlin/Java doesn’t have an option for preemptive scheduler?
Heavy CPU bound task could block the thread and delay other tasks waiting execution. That’s because JVM can’t interrupt running thread and require help from programmer and manual interruption. So writing CPU bound tasks in Java/Kotlin requires manual intervention to make things run smoothly, like using Sequence in Kotlin in code below. As far as I understood the reason is