mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
452 B
30 lines
452 B
/*---
|
|
{
|
|
"custom": true
|
|
}
|
|
---*/
|
|
|
|
/*===
|
|
finalizer, foo -> 123
|
|
===*/
|
|
|
|
var a;
|
|
|
|
/* Note: inside function to ensure that no reference to the value can
|
|
* be active in temporary registers.
|
|
*/
|
|
function init() {
|
|
a = { foo: 123 };
|
|
|
|
Duktape.fin(a, function (x) {
|
|
print('finalizer, foo ->', x.foo);
|
|
});
|
|
}
|
|
|
|
init();
|
|
|
|
// refcount finalizing happens here
|
|
a = null;
|
|
|
|
// mark-and-sweep finalizing happens here if refcount disabled
|
|
Duktape.gc();
|
|
|