JavaScriptCore里面持有 js的回调函数 导致循环引用如何解决? #82
breakerrorchen
started this conversation in
General
Replies: 1 comment 4 replies
-
Please show the full code to reproduce. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
const image = new Image(60, 45); // Using optional size for image
image.onload = function() {
canvas.draw(image)
};
image.src = 'https://mdn.mozillademos.org/files/5397/rhino.jpg';
如果Image是c++实现的,就会出现内存泄漏吧
比如上面的例子 onload 如果被c++层面持有就会有问题。这个用weak 可能回调会失效。如何保证这个场景的正确。
Beta Was this translation helpful? Give feedback.
All reactions