implementing garbage collection (ch26)
This commit is contained in:
21
samples/ch26_gc.lox
Normal file
21
samples/ch26_gc.lox
Normal file
@ -0,0 +1,21 @@
|
||||
fun do_stuff(v) {
|
||||
var s = v + v;
|
||||
print s;
|
||||
}
|
||||
|
||||
fun blah() {
|
||||
var c = "ha" + "ha";
|
||||
|
||||
for(var i = 0; i < 100; i = i + 1) {
|
||||
var d = "ha" + num2str(i);
|
||||
do_stuff(d);
|
||||
}
|
||||
|
||||
return "hiii";
|
||||
}
|
||||
|
||||
var a = blah();
|
||||
|
||||
a = "updated";
|
||||
// GC here.
|
||||
print a;
|
Reference in New Issue
Block a user