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.
33 lines
463 B
33 lines
463 B
12 years ago
|
|
||
12 years ago
|
/*---
|
||
|
{
|
||
|
"custom": true
|
||
|
}
|
||
|
---*/
|
||
|
|
||
12 years ago
|
/*===
|
||
|
finalizer, foo -> 123
|
||
|
===*/
|
||
|
|
||
12 years ago
|
var a;
|
||
12 years ago
|
|
||
12 years ago
|
/* Note: inside function to ensure that no reference to the value can
|
||
|
* be active in temporary registers.
|
||
|
*/
|
||
|
function init() {
|
||
|
a = { foo: 123 };
|
||
|
|
||
|
__duk__.setFinalizer(a, function (x) {
|
||
|
print('finalizer, foo ->', x.foo);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
init();
|
||
12 years ago
|
|
||
|
// refcount finalizing happens here
|
||
|
a = null;
|
||
|
|
||
|
// mark-and-sweep finalizing happens here if refcount disabled
|
||
|
__duk__.gc();
|
||
|
|