Jump to content

Recommended Posts

Posted

I found that Leadwerks2, Leadwerks3 and my own lua-driven projects eating memory. It grows each frame.

 

After adding

 

collectTime=collectTime-AppSpeed()
if collectTime<0 then
collectTime=60
collectgarbage('collect')
end

 

in main loop, seems like used memory stay same size, but "lags" became very visible on collecting garbage.

 

Does anyone here thinking about it, and can make nice smooth results for garbage collecting in Lua?

"Better" is big enemy of "good"

Posted

My best soluton for now is

 

local memoryUsed=math.ceil(collectgarbage("count")/1000) -- in Mb
if memoryUsed>80 then
collectgarbage('collect')
end

 

if used memory more than 80Mb - do garbage collection.

 

Single lag per minute is not so visible :)

"Better" is big enemy of "good"

Posted

It's best to just let Lua automatically run the garbage collector, rather than constantly calling it.

My job is to make tools you love, with the features you want, and performance you can't live without.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...