Re: Question about memory size and performance

Endre Stølsvik <[email protected]> Tue, 11 Dec 2007 21:46:32 +0100
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
Randall R Schulz wrote:
>>> On Tuesday 11 December 2007 11:32, Mann, Ivan H wrote:
>>>
>>> Mann, Ivan H wrote:
>>>> I recall the studies from the 60's on memory allocation, and the
>>>> answer then was that after a while memory fragmentation gets to be a
>>>> serious problem as requests for memory blocks of different sizes are
>>>> made and they use most of pieces of existing blocks, but leave small
>>>> pieces that can be too small.  The result is that you can have a lot
>>>> of memory not being used but not available because it exists in
>>>> blocks smaller than the requests that you make.
>>>>
>>>>
>>> I'm pretty sure Java moves things in memory to defragment the heap.
>>>
>>> Thats why a reference isnt a pointer.
>> I remember years ago reading that as a design goal, but I don't know
>> if today's jvm does that.
>
> How could it not? It's a generational collector and it has to be able to
> move things from one generation to another.

Eh, folks?

Java has used generational compacting collectors for ages - the young
generation is obviously "compacting", in that this is the whole idea
about "generational": It physically moves the currently live objects
from the Eden and Survivor [1|2] spaces into the currently empty
Survivor [2|1] space upon ever minor collection, leaving Eden and
Survivor [1|2] empty).
   The old-gen is also compacting - basically doing a defragmentation
upon every major collection.

Amongst other docs, read:
   http://java.sun.com/javase/technologies/hotspot/gc/index.jsp
   http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html
   http://java.sun.com/javase/technologies/hotspot/gc/gc_tuning_6.html

Endre.

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com