mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-05-01 01:42:14 +00:00
notes on gc.collect that I don't yet know how to work around
This commit is contained in:
parent
25c5dfddad
commit
ed32a4c8ba
@ -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 {
|
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();
|
if (isDefined(__ref_collect)) __ref_collect();
|
||||||
else throw new Error(E_NOTIMPLEMENTED);
|
else throw new Error(E_NOTIMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user