Como he tenido que empaparme de su funcionamiento, aprovecho y pongo un post sobre conceptos básicos de la memoria en Java.
Para empezar, Java divide la memoria en dos segmentos bien diferenciados:
- Heap: Objetos del usuario, variables, …
- Non-Heap/Perm: Código, metadatos, …
La que más nos interesa es la Heap, porque es la que podemos “controlar”. A la memoria Non-Heap (Perm) se le puede configurar el tamaño con el comando MaxPermSize
. Pero esto sólo es útil si la aplicación va a cargar o generar dinámicamente muchas clases diferentes.
La memoria heap se divide a su vez en dos generaciones según su tiempo de vida:
- Young Generation
- Old Generation
Normalmente la generación joven está compuesta de variables locales y objetos temporales, mientras que la generación vieja suele componerse de estructuras que son necesarias durante toda la ejecución: configuraciones, ventanas gráficas,…
As I had to study their operation, I decided to post about the basic concepts of memory in Java.
To begin wtih, Java divides memory into two distinct segments:
- Heap: User objects, variables, …
- Non-Heap/Perm: code, metadata, …
The one that interests us is the Heap, as it is what we can “control”. You can configure the Non-Heap Memory (Perm) size with the parameter MaxPermSize
. But this is only useful if the application is loaded or dynamically generate many different classes.
The heap is divided into two generations according to their lifetime:
- Young Generation
- Old Generation
Usually the younger generation is composed of local variables and temporary objects, while the older generation usually consists of structures that are necessary during the execution: configurations, viewports, …
Continúa leyendo La memoria en Java