Foros del Web » Programación para mayores de 30 ;) » Java »

consulta

Estas en el tema de consulta en el foro de Java en Foros del Web. Hola a todos. tengo la una duda con respecto a la distribicion de la ram en java.He investigado pero no he podido aclarar la duda, ...
  #1 (permalink)  
Antiguo 15/05/2006, 12:01
 
Fecha de Ingreso: abril-2006
Mensajes: 12
Antigüedad: 18 años
Puntos: 0
consulta

Hola a todos.

tengo la una duda con respecto a la distribicion de la ram en java.He investigado pero no he podido aclarar la duda, se que java java divide la ram en 4 secciones, pero desconco realemente cuales son las areas y que almacenan. desde ya se lo agradesco.
  #2 (permalink)  
Antiguo 15/05/2006, 15:36
Avatar de chuidiang
Colaborador
 
Fecha de Ingreso: octubre-2004
Mensajes: 3.774
Antigüedad: 19 años, 7 meses
Puntos: 454
Hola:

No sé si te refieres a esto, pero aquí cuentan como se organiza la memoria para optimizar el recolector de basura.

Habla de varias zonas de memoria (creo que tres a su vez subdividadas en otros cachos). Las clases recien instanciadas comienzan en una zona. Según va pasando el tiempo y esas clases sobreviven (no las limpia el recolector de basura), se pasan a la siguiente zona (de clases más viejas). El recolector entra con mucha frecuencia en la zona de las clases jovenes y con menos frecuencia en la de las clases más viejas.

Se bueno.
__________________
Apuntes Java
Wiki de Programación
  #3 (permalink)  
Antiguo 15/05/2006, 16:08
Avatar de jahepi
Colaborador
 
Fecha de Ingreso: diciembre-2004
Ubicación: Querétaro
Mensajes: 1.124
Antigüedad: 19 años, 4 meses
Puntos: 43
Hola, también esto puede servir, sacado del libro Thinking in Java 3rd Edition.

Cita:
Where storage lives

It’s useful to visualize some aspects of how things are laid out while the program is running—in particular how memory is arranged. There are six different places to store data: Feedback

1. Registers. This is the fastest storage because it exists in a place different from that of other storage: inside the processor. However, the number of registers is severely limited, so registers are allocated by the compiler according to its needs. You don’t have direct control, nor do you see any evidence in your programs that registers even exist. Feedback

2. The stack. This lives in the general random-access memory (RAM) area, but has direct support from the processor via its stack pointer. The stack pointer is moved down to create new memory and moved up to release that memory. This is an extremely fast and efficient way to allocate storage, second only to registers. The Java compiler must know, while it is creating the program, the exact size and lifetime of all the data that is stored on the stack, because it must generate the code to move the stack pointer up and down. This constraint places limits on the flexibility of your programs, so while some Java storage exists on the stack—in particular, object references—Java objects themselves are not placed on the stack. Feedback

3. The heap. This is a general-purpose pool of memory (also in the RAM area) where all Java objects live. The nice thing about the heap is that, unlike the stack, the compiler doesn’t need to know how much storage it needs to allocate from the heap or how long that storage must stay on the heap. Thus, there’s a great deal of flexibility in using storage on the heap. Whenever you need to create an object, you simply write the code to create it by using new, and the storage is allocated on the heap when that code is executed. Of course there’s a price you pay for this flexibility. It takes more time to allocate heap storage than it does to allocate stack storage (if you even could create objects on the stack in Java, as you can in C++). Feedback

4. Static storage. “Static” is used here in the sense of “in a fixed location” (although it’s also in RAM). Static storage contains data that is available for the entire time a program is running. You can use the static keyword to specify that a particular element of an object is static, but Java objects themselves are never placed in static storage. Feedback

5. Constant storage. Constant values are often placed directly in the program code, which is safe since they can never change. Sometimes constants are cordoned off by themselves so that they can be optionally placed in read-only memory (ROM), in embedded systems. Feedback

6. Non-RAM storage. If data lives completely outside a program, it can exist while the program is not running, outside the control of the program. The two primary examples of this are streamed objects, in which objects are turned into streams of bytes, generally to be sent to another machine, and persistent objects, in which the objects are placed on disk so they will hold their state even when the program is terminated. The trick with these types of storage is turning the objects into something that can exist on the other medium, and yet can be resurrected into a regular RAM-based object when necessary. Java provides support for lightweight persistence, and future versions of Java might provide more complete solutions for persistence.
Perdón por no traducirlo pero es mucho,

Un saludo!
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:33.