Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
Java 17 stack size and actual memory consumption

Is there any real downside to allow for a VERY large stack on the JVM, like gigabytes?

In particular, with many threads, is this going to give troubles? if the stack space is not actually used, is there going to be more wasted memory in practice on the most used JVMs running on win/linux/mac?

For example, if I allocate 1GB for the stack, and I run 100 threads, but they do not actually fill up the stack space with actual data, would running the program require 100GB of actual physical memory?

This question is strongly connected with this old one (Dynamically expandable JVM stack) that was asked 10 years ago when the Java environment was quite different.

Now near every Java program runs over a 64 bits architecture, and so much in JVM has overall improved.

Expansion: I'm often running very complex recursive programs on large/deep data structures, and having to use free monads or other program transformations to use the heap instead of the stack is complex, slow and possibly pointless. An alternative would be using Java looms fibers, but.. again, may be just allocating a duper stack is easier and faster. I see why this is not done in C/C++, but under a VM this should be reasonable. Is it?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!