Lua Binding Memory Leak

Hi, all
I test this in HelloLua project.I write the hello.lua to follow:

function updateTime()
collectgarbage(“collect”)
print(“memory3:”, collectgarbage(“count”))
end

updateFunc_ = CCDirector:sharedDirector():getScheduler():scheduleScriptFunc(updateTime, 60, false)

collectgarbage(“collect”)

print(“memory1:”, collectgarbage(“count”))

—all of these will be auto released later
for i=1,100000 do
CCAnimation:create()
CCMenu:create()
CCLabelTTF:create()
CCScene:create()
CCLayer:create()
CCNode:create()
CCSprite:create()
end

collectgarbage(“collect”)
collectgarbage(“collect”)
collectgarbage(“collect”)
collectgarbage(“collect”)

print(“memory2:”, collectgarbage(“count”))

Run, and wait for a few minutes, I get thsi result:
[LUA-print] memory1: 776.4794921875
[LUA-print] memory2: 23305.096679688
[LUA-print] memory3: 23304.478515625

Is this a memory leak? And Could I avoid this? Thanks

The hello.lua file is here, just replace the original and you can test it!

Do you test on Android or iOS? I made tests on the iOS XCode Profiler and while it seems to have a memory leak at first, if you profile it (or count references) you will see that the memory count will stop to rise at some point. You should also test what happens when you leave a lua scope. Since some variables may only be released then.

It seems maybe a drawback of lua.In the Programming in Lua, it says when create many userdata or a very large table,the gc collector will meet a problem.