-
Notifications
You must be signed in to change notification settings - Fork 29
[copy_gc & mark_sweep] User Guide
This is a user guide on the visualisation of these memory management techniques written by Sheikh Umar:
- Stop-and-Copy Garbage Collection
- Mark-Sweep Garbage Collection
- Please familiarise yourself with the Developer Guide on the APIs used for the visualisation of the aforementioned garbage collection techniques via https://github.com/source-academy/modules/wiki/%5Bcopy_gc-&-mark_sweep%5D-Developer-Documentation.
- Proceed to https://sourceacademy.nus.edu.sg/playground.
- Enter your source code on either of the aforementioned garbage collection techniques into the Source Academy playground.
- At the top of the program, import the APIs of the respective garbage collection techniques.
- For the Stop-and-Copy Garbage Collection, declare these APIs:
import { init, initialize_memory, initialise_tag, newCopy, newFlip, newPush, newPop, newAssign, newNew, scanFlip, startFlip } from 'copy_gc';
- For the Mark-Sweep Garbage Collection, declare these APIs:
import { init, initialize_memory, newAssign, newPush, newPop, newNew, initialise_tag, newGC, newMark, newSweep } from 'mark_sweep';
- Enter
init()
at the end of your source code. - Click 'Run'. If you are running code for Stop-Copy Garbage Collection, please proceed to step 6. If you are running code for Mark-Sweep Garbage Collection, please proceed to step 7.
- You will see two heaps denoting the To Space heap and the From Space heap.
You may drag the slider or select either the ‘-’ or ‘+’ icon on Current step section to see a step-by-step visualization for the Stop-Copy Garbage Collection. Alternatively, you may click on the ‘^’ icon below the slider to navigate to key steps of the Stop-Copy Garbage Collection. Here is an example of the visualisation for the Scan phase. The green and yellow colours denote where the Scan and Free pointers respectively.
- You will see the memory at the initialization stage.
You may drag the slider or select either the ‘-’ or ‘+’ icon on Current step section to see a step-by-step visualization for the Mark-Sweep Garbage Collection. Alternatively, you may click on the ‘^’ icon below the slider to navigate to key steps of the Mark-Sweep Garbage Collection.
Here is an example of the Mark-Sweep Garbage Collection at the Mark phase:
- Home
- Overview
- System Implementation
-
Development Guide
- Getting Started
- Repository Structure
-
Creating a New Module
- Creating a Bundle
- Creating a Tab
- Writing Documentation
- Developer Documentation (TODO)
- Build System
- Source Modules
- FAQs
Try out Source Academy here.
Check out the Source Modules generated API documentation here.