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

Default featured post

How to use ActiveJDBC with Spring Boot

Last updated on 5 June, 2024
Default featured post

How to get rid of getter, setter in Java

Last updated on 5 August, 2020
AWS Lambda Java

Getting started with AWS Lambda and API gateway to building Rest APIs

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