Cheney's algorithm: Difference between revisions

Content deleted Content added
No edit summary
m <source> → <pre>
Line 19:
==Sample algorithm==
 
<sourcepre>
initialize() =
tospace = 0
Line 25:
allocPtr = tospace
scanPtr = whatever -- only used during collection
</sourcepre>
 
<sourcepre>
allocate(n) =
If allocPtr + n > tospace + N/2
Line 38:
allocPtr = allocPtr + n
return o
</sourcepre>
 
<sourcepre>
collect() =
swap(fromspace, tospace)
Line 59:
EndWhile
 
</sourcepre>
 
<sourcepre>
copy(o) =
If o has no forwarding address
Line 71:
return forwarding-address(o)
 
</sourcepre>
 
== Semispace ==