v3quick icon indicating copy to clipboard operation
v3quick copied to clipboard

LuaEventNode leak

Open lenew opened this issue 11 years ago • 4 comments

it maybe a memory leak with the following code: node:setTouchSwallowEnabled(false) node:setTouchEnabled(false) , when look deep in c++ code, setTouchSwallowEnabled create a LuaEventNode by mng->getLuaNodeByNode(self, true); but this LuaEventNode may have no chance to remove.

fix: call setBaseNodeEventListener() in NodeEx.lua

ps setTouchCaptureEnabled setTouchMode setTouchSwallowEnabled, may have the same issue.

lenew avatar Jan 04 '15 14:01 lenew

Fixed. Thank you!

SunLightJuly avatar Jan 05 '15 03:01 SunLightJuly

another case may cause leak. local node = display.newNode() node:setTouchEnable(true) -- don't add this node to any container node.

in this case 'clean' event never have chance to send, LuaEventNode will leak.

lenew avatar Jan 05 '15 05:01 lenew

It can't be solved now, because we don’t want to modify the class 'Node'. Don‘t use a node as this.

SunLightJuly avatar Jan 05 '15 07:01 SunLightJuly

Implement LuaEventNode as a Node Component may be a good idea~~ it also can increase getLuaNodeByNode performance. in target finding phrase when TOUCH DOWN. this function is heavily called by onTouchesBegan through checkTouchableNode->getParent(). if 200 touchable node on screen, the fps drop down significantly!

lenew avatar Jan 06 '15 09:01 lenew