Sign in to follow this  
ddn3

Good way to track memory in Lua?

Recommended Posts

I've implemeneted an A* search in Lua, which was surpisingly easy, but it generates alot of garbage which causes Lua to stutter when it collect it. I can get around it by calling collectgarbage after the path finding, which collects it then, but it would be more useful if I could find the cause of this garbage and remove it in the first place. Is there a general method, library or patch for Lua which will allow me to track garbage generation on a line by line basiss ? Thanks again! -ddn

Share this post


Link to post
Share on other sites
Well I did find the source of the garbage, just to give people an update, if they are facing the same problem.

I just used blocks of gcinfo() calls and record the garbage mem per block, then using a simple binary search traced it down to the open list nodes which were being dumped per search iteration, i changed it to use a deadlist which puts all the dead open nodes into, and the garbage generated per search iteration dropped by a factor of 10 so thats good.

-ddn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this