notes on gc.collect that I don't yet know how to work around

This commit is contained in:
dcode 2019-04-04 12:53:42 +02:00
parent 25c5dfddad
commit ed32a4c8ba

View File

@ -144,8 +144,19 @@ export namespace runtime {
}
}
/** Performs a full garbage collection cycle. */
/** Performs a full garbage collection cycle.*/
// @ts-ignore: decorator
@unsafe
export function collect(): void {
// FIXME: annotated unsafe because calling it in the middle of a function collects inner
// references prematurely with a tracing GC, which is pretty bad actually.
// function explode(): Ref {
// var ref = new Ref();
// gc.collect(); // collects ref
// return ref;
// }
if (isDefined(__ref_collect)) __ref_collect();
else throw new Error(E_NOTIMPLEMENTED);
}