exposing manual garbage collection function with Isolated virtual machines runtime



  • Something that would be awesome, is if once isolated virtual machine is implemented and each player gets their own runtime and only deals with garbage collection of their own objects, a manual garbage collection function gets exposed to the player. I feel like it would be beneficial to the player to be able to plan for a garbage collection instead of it hitting them at random.



  • I like this idea. not certain about the difficulty, but I feel like being able to run for, say, 100 ticks and then save and deliberately garbage collect yourself could do a lot to help low CPU players.



  • From what I'm seeing, it wouldn't be too difficult. You can expose the v8::HEAP->CollectAllGarbage function to the global JavaScript namespace via the command flag --expose_gc. Then simply call gc(); source: https://stackoverflow.com/questions/10719967/v8-manually-initiate-the-garbage-collector.

    The devs have pulled in patches seperate from the standard node.js compilation in the past. If they are unable to specifiy the specific flag, they could patch that functionality in manually. As far as exposing that to inside the IVM, I do not know how difficult that would be...



  • Yeah, I don't anticipate it being difficult. I was partially hedging out of respect to @artch so I didn't end up going "DIS SO EASY Y U NO IMPLEMENT?!"

    Still, thinking about this, I could actually integrate it into my OS arch somewhat effectively too, if I could control when it GC'd.



  • I completely understand. If they come back and say its too difficult, I would be disappointed, but wouldn't judge em for it lol