Closed niklauslee closed 5 years ago
This seems related with #3172 (I'm not sure)
Confirmed that jerry_cleanup()
will call free callback functions. Need to check there is no reference from C API to the object having gc_handle
.
More simplified bug reproduce code (Try in playground):
var BufferedGC = require('graphics').BufferedGraphicsContext;
var gc = new BufferedGC(128, 64, {
display: (buffer) => {}
});
global.gc = gc;
The above code do not call free callback when .reset
. But if removing display function, free callback successfully called when .reset
var BufferedGC = require('graphics').BufferedGraphicsContext;
var gc = new BufferedGC(128, 64, {
// display: (buffer) => {}
});
global.gc = gc;
This issue is resolved. There were many reasons causing this problems:
JERRYXX_GET_ARG_OPT()
. It shouldn't. Now JERRYXX_GET_ARG_OPT()
has removed, so JERRYXX_GET_ARG()
should be used with checking JERRYXX_HAS_ARG()
. This problem were found in many native modules I2C, SPI, etc. Actually this problem caused system stuck.gc_handle
struct (display_js_cb
, etc.) prevented GC. So now move them into the class member variables (e.g. this.__display_cb
) so as to allow GC.setTimeout()
didn't release values even when it timed out. This also prevented GC.Exact matching jerry_get/create_*
and jerry_release_value
is very important
Great job!! Thank you for your hard work!
Reproduce steps:
ex_128x64.js
(orex_128x32.js
) code in https://kameleon.io/@niklauslee/ssd1306. Upload action will load code automatically..load
in terminal.Same problem in https://kameleon.io/@niklauslee/ssd1351