I'm studying the garbage collection code of Alex Aiken's COOL programming language's runtime system.

(This is the language used in a relatively famous Stanford Online Compilers course)

A major garbage collection is triggered according to a formula described in the runtime system's code:

#     breakpoint: Point where a major collection will occur.  It is
#         calculated by the following formula:
#         breakpoint = MIN(L3-MAX(MAJOR0,MAJOR1)-MAX(MINOR0,MINOR1),
#                          L3-(L3-L0)/2)
#         where (variables stored in the header):
#           MAJOR0 = total size of objects in the new area after last major
#                    collection.
#           MAJOR1 = (MAJOR0+MAJOR1)/2
#           MINOR0 = total size of objects in the reserve area after last
#                    minor collection.
#           MINOR1 = (MINOR0+MINOR1)/2

Could someone please describe the reasoning this formula is based on or point me to documentation explaining it.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.