A possible solution for JSB memory model (for solving "invalid native object")

@pandamicro Thanks!

ok, I will support you with my possible. And I’m really hope that we will never care about "invalid native object " error at JSB 3.1.

Thinks.

One consideration for the proposed memory mode, consider the following line in a function:
var spr = new cc.Sprite(“xxx.png”)

In current memory model: native object will be autoreleased, js object will be gc collected, everything is fine

In the proposed memory model: native object won’t get released because it’s retained by js object, and js object won’t get released either because it’s rooted
So now I have to manually release the native object to actually release it, and it’s AGAINST THE PURPOSE OF AUTO RELEASE

This autorelease situation may be silly for an image object, but it’s useful for others objects like utility ones, and is very likely existing in current code

You will not need to manually release native object on this memory mode.
it will auto release when no object reference to it

A big problem with this proposed is it will too late to release object at a complication context
I was told to @pandamicro this problem. it is a difficult problem!