Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

138
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda