TLDR; Why bother settings -Xmx and -Xms in a kubernetes app? We’ve inherited a kubernetes app that is having out of memory errors. It looks like the initial devs set kubernetes resource limits (.95 CPU core and 4Gb memory) as shown below. However, they also set the max heap size in JAVA_OPTS -Xmx to 800mb. I’ve found lots of good
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
I want to understand how java allocates objects in heap. I want to know which parts of the JDK code are triggered when the “new” keyword is used. How can I define a function that a user can …
I have read other question-answers regarding final instance variables and i came to knew that non-static final instance variables are created in heap for every instance of the class but in java -the complete reference by herbert schildt it is said that : Variables declared as final do not occupy memory on a per-instance basis .thus, a final variable is
This question is not about difference between Stack and Heap in Java. In C++, both Stack and Heap are in RAM. How is it in Java? Answer Yes. Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer’s RAM This is to ensure faster processing of java programs.
When an object calls a function, the function would be pushed from the method area into the stack. My question is: Q: What does that “push” mean in this context? Does that simply mean move(from the method area) or copy of the function(a copy of the method pushed onto the stack)? Answer The method itself is not pushed onto the
I have not been able to find any reliable literature on this but i’m curious as to where an object is stored if its created inside of a method ? on the stack or on the heap in java 8? I know that normally only local primitives, reference variables and function calls are stored on the stack and that objects
I am investigating JVM architecture and its working behind the scenes. I have heard a lot of times that stack stores method return types, operands, local variables and references to objects. But while reading the Oracle specification I have found the picture where drawn that stack frame has no references to objects directly but the reference to the constant pool.
My java process hangs. It reads input data and parses it into Integer and write them into disks. jvisualvm shows the process is fully using the heap space. (java.lang.Integer and java.lang.Integer use 77% and 22% of the heap space respecitvely) AFAIK the java process dies showing OutOfMemory error messages when the memory capacity is not enough. Why my process hangs
I have a repeating process that: gets some data from the database builds some objects in memory, adding to a Collection writes the data from the Collection to a file All of the objects/Collections go out of scope or are set to null after each iteration. (The Collection is reused for each iteration.) Using Java VisualVM, I see a graph