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

350
Visualizações
How does java guarateee reserved memory

Checking for memory usage by stack using this command:

jcmd $pid VM.native_memory summary

I can see that reserved memory is different from committed.

  •                Thread (reserved=18561KB, committed=1085KB)
                          (thread #18)
                          (stack: reserved=18476KB, committed=1000KB)
                          (malloc=63KB #99) 
                          (arena=22KB #35)
    

Reserved is about 1MB (default for stack). Committed in fact is physical reserved. I read that java save memory for stack while is not totally used.

Running command like top I can see just committed usage.

What does java/SO do in order to reserve this memory without being counted by RSS (linux memory measure) statistics?

Could other process use this memory due that is no physically reserved?

Note: jdk11 SO Linux

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

What does java/SO do in order to reserve this memory without being counted by RSS (linux memory measure) statistics?

This kind of "reservation" is based on the concept of Virtual Memory. The JVM calls mmap to reserve an address space. Initially these addresses are just numbers not backed by physical pages. On the first access to a virtual page, a page fault happens, and the OS handles it by allocating the backing storage (physical RAM or a swap space).

Could other process use this memory due that is no physically reserved?

In short, yes. A longer answer - depends on the OS settings, specifically, vm.overcommit_memory and vm.overcommit_ratio sysctls. The default settings allow overcommitment - i.e. it's possible to allocate more virtual memory than available physical RAM + swap (because applications often do not use all virtual memory they reserve).

over 4 years ago · Santiago Trujillo Relatório

0

You need to understand that in any modern operating system, "memory" is virtual.

"Reserved" memory is actually just address space that is assigned to a particular use. What this means is mostly just some adjustment of data structures that track address-space use.

"Committed" memory is a little more wiggly. Mostly it just means that the physical memory that could be needed is tracked against some notion of the maximum commit that is available. There's generally no notion that actual physical RAM is somehow allocated to the process at this point; at best, pagefile space may be reserved.

(If you want actual for-sure RAM, you need to "pin" committed pages into physical memory).

Actual RAM isn't assigned until a page is touched; and even after that, it can be taken away again, by the dynamics of paged virtual memory, in part depending on what else is happening on the hardware.

over 4 years ago · Santiago Trujillo Relatório
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