JVM (Java) and it’s Memory Management

JVM (Java Virtual Machine) is an abstract machine or can say it is a software implementation of a Physical Machine. It is a specification that provides runtime environment in which java bytecode can be executed. JVMs are available for many hardware and software platforms (i.e. JVM is platform dependent). What is JVM It is: A specification: Where working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Oracle and other companies. An implementation: Its implementation is known as JRE (Java Runtime Environment). Runtime Instance: Whenever you write java command on the command prompt to run the java class, an instance of JVM is created. What it does The JVM performs following operation: Loads code Verifies code Executes code Provides runtime environment JVM provides definitions for the: Memory area Class file format Register set Garbage-collected heap Fatal error reporting… Read more“JVM (Java) and it’s Memory Management”

Analysing and fixing Java Heap related Issues

Java Heap related issues can cause severe damage to our application and we might see poor user experience. Java Heap is memory used by your application which is used to create and store objects. We can define the maximum memory for heap by specifying -Xmx<size> by setting the java variable. When your application runs, it will gradually fill up Heap and memory must be released to keep our application working. Hence Java periodically runs a process called ‘Garbage collection(GC)‘ which will scan the heap and clear objects that are no longer referenced by your application.One cannot request Garbage Collection on demand. Only JVM can decide when to run GC. A Heap dump is a snapshot of the memory of when the heap dump was taken.Heap dumps are not commonly used because they are difficult to interpret. But, they have a lot of useful information in them if you know where/how… Read more“Analysing and fixing Java Heap related Issues”