feat: add System.gc() method and replace test's Api.gc() with it

Add a new `System.gc()` primitive that calls `wrenCollectGarbage` to allow
scripts to trigger garbage collection. Document the method in the core
System page. Remove the test-only `Api.gc()` foreign method and update
the foreign_class test to use `System.gc()` instead.
This commit is contained in:
Bob Nystrom
2015-10-24 17:56:27 +00:00
parent c9a7dba0c1
commit 498d1af8d0
4 changed files with 20 additions and 15 deletions
+10 -5
View File
@@ -6,6 +6,16 @@ use during development or debugging.
## Static Methods
### System.**clock**
Returns the number of seconds (including fractional seconds) since the program
was started. This is usually used for benchmarking.
### System.**gc**()
Requests that the VM perform an immediate garbage collection to free unused
memory.
### System.**print**()
Prints a single newline to the console.
@@ -36,8 +46,3 @@ afterwards. Converts the value to a string by calling `toString` on it.
In the above example, the result of `4 + 5` is printed, and then the prompt is
printed on the same line because no newline character was printed afterwards.
### System.**clock**
Returns the number of seconds (including fractional seconds) since the program
was started. This is usually used for benchmarking.