Jump to content
  • Advertisement
Sign in to follow this  
aayudh

question on lua Coroutines

This topic is 3476 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, What happens if we never resume a lua coroutine ? How will it get freed runtime ? Is there a way to say, "I am not going to resume you anymore...just go and die", to the coroutine ?? -madan

Share this post


Link to post
Share on other sites
Advertisement
I'm not positive, but I believe it stays in memory and is never garbage collected. I ran into quite a few issues recently running out of memory when I had scripts controlling the behavior of hundreds of objects. I believe this was one of the main causes.

You can easily pass a parameter to resume which you could use to determine if you want to end the script or not. At least you can bring the coroutine to a "dead" status that way. I've been looking into it, and information on the inner workings of the language seems to be hard to find. Hopefully someone knows the details.

Share this post


Link to post
Share on other sites
but parameters to coroutine.resume are stored onto the function stack and don't change. I dont know if it is mentioned, but you only need to pass parameters to resume once. The next time, you dont need to specify them !!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!