If the app run out of memory, then it means that a reference to the bitmap is kept somewhre. The createImage function does not keep a reference itself, so this means that a reference is kept elsewhere by the caller. JavaScript is known to retain a lot of references due to closures. Could you share your script (or a fragment to isolate the leak) ?
If you can recycle them without a crash then it also means the bitmap is not drawn anymore but that probably means also that the reference is still kept somewhere: it will leak a lot less memory, but the leak is still here. If you need more investigations I can use tools to look for leaks.
< ![CDATA[
It seems that this happens only if done repeatedly… (Maybe images are not released correctly?)
]]>
< ![CDATA[
If the app run out of memory, then it means that a reference to the bitmap is kept somewhre. The createImage function does not keep a reference itself, so this means that a reference is kept elsewhere by the caller. JavaScript is known to retain a lot of references due to closures. Could you share your script (or a fragment to isolate the leak) ?
]]>
< ![CDATA[
function screenshot(){
var view=d.getView();
var img=LL.createImage(view.getWidth(),view.getHeight());
var c=img.draw();
view.draw(c);
return img.getBitmap();
}
]]>
< ![CDATA[
Where d is a desktop.
]]>
< ![CDATA[
So it depends on what you do with the result of screenshot(). But yes, if d is a desktop, these images will rapidly consume a lot of memory.
]]>
< ![CDATA[
I’m now manually recycling the bitmap after use, it helps a lot.
]]>
< ![CDATA[
If you can recycle them without a crash then it also means the bitmap is not drawn anymore but that probably means also that the reference is still kept somewhere: it will leak a lot less memory, but the leak is still here. If you need more investigations I can use tools to look for leaks.
]]>
< ![CDATA[
Is it possible to free (like in C) a reference, or to unlink all reference of an object? (so it can just be deleted from memory)
]]>
< ![CDATA[
Special for bitmaps there is a specific call: bitmap.recycle()
]]>
< ![CDATA[
Benoît de Chezelles no
]]>