JVM Memory Architecture and GC Algorithm Basics

Purpose

This article discusses the basic concept of JDK8 and upwards memory management with heap and stack memory. and the basics of GC and its Algorithms.

Importance of Memory Management

Java garbage collector doesn't ensure that the heap memory will be completely free, and also, for a developer, it is not possible to force a garbage collector to run at a specific time. So it is helpful to know how memory management in Java works. 

Best Practices: Java Memory Arguments for Containers

When running your Java application in physical servers, you would have been using ‘-Xmx’ JVM argument to specify the Java heap size. If you are porting your application to Containers, you might be wondering how to configure Java heap size in the container’s world? Are there any best practices? In this article, we will discuss the possible JVM arguments that can be used to specify the Java heap size and the best option to choose. 

There are 3 different options to specify the maximum Java heap size in containers. They are: