---
title: "How to change the heap size of a JVM ?"  
description: "How to change the heap size of a JVM ?"  
author: "Anonymous User"  
published: 2015-07-13  
updated: 2020-09-18  
canonical: https://www.mindstick.com/interview/2696/how-to-change-the-heap-size-of-a-jvm  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# How to change the heap size of a JVM ?

The old generation's default heap size can be overridden by using the -Xms and -Xmx switches to specify the initial and maximum sizes respectively:\

```
Format - java -Xms <initial size> -Xmx <maximum size> programExample - java -Xms64m -Xmx128m Myprogram
```

## Answers

### Answer by Anonymous User

The old generation's default heap size can be overridden by using the -Xms and -Xmx switches to specify the initial and maximum sizes respectively:\

```
Format - java -Xms <initial size> -Xmx <maximum size> programExample - java -Xms64m -Xmx128m Myprogram
```


---

Original Source: https://www.mindstick.com/interview/2696/how-to-change-the-heap-size-of-a-jvm

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
