mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
js: Exercise the garbage collector a little bit
This commit is contained in:
parent
63e4b744ed
commit
d9126b1ad5
1 changed files with 11 additions and 0 deletions
|
@ -33,6 +33,8 @@
|
|||
|
||||
int main()
|
||||
{
|
||||
// function foo() { return 1 + 2; }
|
||||
// foo();
|
||||
auto program = make<JS::Program>();
|
||||
|
||||
auto block = make<JS::BlockStatement>();
|
||||
|
@ -55,5 +57,14 @@ int main()
|
|||
dbg() << "Interpreter returned " << result;
|
||||
|
||||
printf("%s\n", result.to_string().characters());
|
||||
|
||||
interpreter.heap().allocate<JS::Object>();
|
||||
|
||||
dbg() << "Collecting garbage...";
|
||||
interpreter.heap().collect_garbage();
|
||||
|
||||
interpreter.global_object().put("foo", JS::Value(123));
|
||||
dbg() << "Collecting garbage after overwriting global_object.foo...";
|
||||
interpreter.heap().collect_garbage();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue