Skip to content
Geeky Hacker

Geeky Hacker

Coding, Tech & Linux

  • Spring Boot
  • JPA
  • Kafka
  • Testing
    • Testcontainers
    • Mockito
  • Java
  • Kotlin
  • Linux
  • DevOps
    • AWS
    • CI/CD
    • Docker
    • Kubernetes
  • Database
    • MySQL
    • PostgreSQL
  • Spring Boot
  • JPA
  • Kafka
  • Testing
    • Testcontainers
    • Mockito
  • Java
  • Kotlin
  • Linux
  • DevOps
    • AWS
    • CI/CD
    • Docker
    • Kubernetes
  • Database
    • MySQL
    • PostgreSQL
Java

Increasing size of heap memory in Java

Kasra Madadipouyaby Kasra MadadipouyaLast updated on 5 June, 2024
Default featured post

In Java size of heap memory by default is 64MB, however if your application holds many objects then you might get the following exception,

java.lang.OutOfMemoryError: Java heap space

There is a simple solution for the problem and it would be reached by increasing your heap size on runtime with the following command,

$ java -Xms256m -Xmx1024m YourClassName/JarFileName

The first parameter defines the minimum heap size and the second parameter sets the maximum size of heap for your application.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Reddit (Opens in new window) Reddit
  • More
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to email a link to a friend (Opens in new window) Email
  • Click to print (Opens in new window) Print

You might also like

Why JVM does not release unused memory eagerly, a discussion

Why JVM does not release unused memory eagerly, a discussion

Last updated on 30 December, 2024
Taking Java apps heap dumps on Kubernetes (poor man's way)

Capture Java apps heap dumps on Kubernetes (the poor man’s way)

Last updated on 29 March, 2024
How to add Swagger to Quarkus

How to add Swagger to Quarkus

Last updated on 5 June, 2024

Popular

  • High-performance data fetching using Spring Data JPA Stream High-performance data fetching using Spring Data JPA Stream
  • Synchronize audio and video with FFmpeg Synchronize audio and video with FFmpeg
  • Test Spring Kafka consumer and producer with EmbeddedKafka Test Spring Kafka consumer and producer with EmbeddedKafka
  • How to fix grub/i386-pc/normal.mod not found How to fix grub/i386-pc/normal.mod not found
  • Configure SSH key-based authentication on Raspberry Pi Configure SSH key-based authentication on Raspberry Pi
  • Terms of Service
  • Cookie Policy
  • Privacy Policy
  • X
  • GitHub
  • Telegram
  • YouTube
  • RSS Feed
  • Cheat Sheets
  • Donate
  • Contact
© 2013-2025 Geeky Hacker Powered by WordPress and Bam.
Donate Ethereum

Yet another cryptocurrency that is super popular. You can donate us in Ethereum.

Geeky Hacker wallet number: 0x1f98767fB7c51efc35C313B0015C6aB453D4ED31

Donate BAT

BAT is a coin that is used by Brave Browser which is getting more popularity day by day.

Geeky Hacker wallet number: 0x40146D985b995E5bB5b2A7FDc618db689a811DCB

Donate Bitcoin

The unbeatable, the father and the king of kings, Bitcoin!

Geeky Hacker wallet number: 1NaGzvbXQtM9PCduXgmFeXe8D4i5C1nDyu