0x334 Runtime
- 1. Garbage Collection - 1.1. Tracing - 1.2. Reference Count
- 2. Debugger - 2.1. gdb - 2.2. lldb - 2.2.1. frame instructions - 2.2.2. memory instructions - 2.2.3. evaluation
- 3. Reference
1. Garbage Collection
Interestingly, according to Wikipedia, Garbage collection was invented by John McCarthy around 1959 to simplify manual memory management in Lisp.
1.1. Tracing
This is the most common approach.
It is tracing which objects are reachable by a chain of references from certain "root" objects, and considering the rest as "garbage" and collecting them.
1.2. Reference Count
Another common approach
2. Debugger
2.1. gdb
- i r: print variables
- x/(number) (memory or register): print data around memory
2.2. lldb
2.2.1. frame instructions
- bt: print stack frames
- fr v (-L): print variables in a frame (with its location)
- fr s frame_number: switch to different frames
2.2.2. memory instructions
- mem read (memory or register)+(offset): print data around memory
2.2.3. evaluation
- eval (expression)