deep

a Cross Development Platform for Java

User Tools

Site Tools


dev:rts:heap

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dev:rts:heap [2015/03/17 15:32] – [Sweep Phase] ursgrafdev:rts:heap [2020/12/14 10:32] (current) – [Mark Phase] ursgraf
Line 1: Line 1:
 ====== Heap Manager and Garbage Collection ====== ====== Heap Manager and Garbage Collection ======
 ===== General Information ===== ===== General Information =====
-Currently we support a simple mark & sweep algorithm. With this the mark phase must not be interrupted, while sweeping can be done piecewise. Lists with free blocks are kept by the class //Heap//. Adresses of free blocks are simple Integer values.+Currently we support a simple mark & sweep algorithm. With this the mark phase must not be interrupted, while sweeping can be done piecewise. Lists with free blocks are kept by the class //Heap//. Adresses of free blocks are simple integer values.
      
 ===== Initialization ===== ===== Initialization =====
Line 10: Line 10:
 There are 8 lists with block sizes of (Bytes) 16, 32, 48, 64, 80, 96, 112 and >= 128. At the very beginning there is no array with these lists. Therefore the allocation must be done "by hand". Only after the class constructor of the class //Heap// is executed the rest of the heap can be entered as a free block. \\  There are 8 lists with block sizes of (Bytes) 16, 32, 48, 64, 80, 96, 112 and >= 128. At the very beginning there is no array with these lists. Therefore the allocation must be done "by hand". Only after the class constructor of the class //Heap// is executed the rest of the heap can be entered as a free block. \\ 
 To be able to follow the free blocks (when searching a new block or when sweeping) the structure below is used: To be able to follow the free blocks (when searching a new block or when sweeping) the structure below is used:
-[{{ .:freeblock.png?350&direct | //Liste mit freien Blöcken//}}]+[{{ .:freeblock.png?350&direct | //List with free blocks//}}]
 The field //size// holds the size of the block, //next// gives the address of the next free block. There is no java class for these free blocks. The reason for this is that free and used blocks must be efficiently changed into each other.  The field //size// holds the size of the block, //next// gives the address of the next free block. There is no java class for these free blocks. The reason for this is that free and used blocks must be efficiently changed into each other. 
 [{{ .:freeblock1.png?200&direct | //Free Block//}}] [{{ .:freeblock1.png?200&direct | //Free Block//}}]
Line 16: Line 16:
  
 ===== Mark Phase ===== ===== Mark Phase =====
-Starting with the roots, all used blocks are marked. Objects may contain fields which are references. These references ,ust be followed as well. The type descriptors contain the information about which fields are references.+Starting with the roots, all used blocks are marked. Objects may contain fields which are references. These references must be followed as well. The type descriptors contain the information about which fields are references.
  
 ===== Sweep Phase ===== ===== Sweep Phase =====
-During the sweep phase the whole heap is traversed block by block. Each block, whether free, marked or no longer used has to include information about its size. Free blocks and blocks which contain actual objects have this information at the start of the block. With arrays this information has te be retrieved with the aid of the type descriptor.+During the sweep phase the whole heap is traversed block by block. Each block, whether free, marked or no longer used has to include information about its size. Free blocks and blocks which contain actual objects have this information at the start of the block. With arrays this information has to be retrieved with the aid of the type descriptor.
 [{{ .:sweep.png?550&direct | //Sweep//}}] [{{ .:sweep.png?550&direct | //Sweep//}}]
  
dev/rts/heap.1426602750.txt.gz · Last modified: 2016/02/25 13:33 (external edit)