Destroy Actor Clean Up

azimpactazimpact Member Posts: 112
edited November -1 in Working with GS (Mac)
I'm getting deeper into my game and have seen posts about garbage cleanup.

I want to make sure I do it right from the start before I go deeper so I have a few questions if someone could answer it would be greatly appreciated.

1. When an actor is destroyed in a scene, is the memory usage from that actor freed up or does it linger until you leave that scene. If so, how do you make sure they are actually destroyed and free up any resources that they were using?

2. Any good links to posts about cleaning up the garbage during game play?

Comments

  • JeffreyShimaneJeffreyShimane Member Posts: 372
    1. The destroy behavior destroys the actor but I don't believe the resources are freed up immediately in GS (for whatever reason) like it would be using release in Xcode or other SDKs. I assume it does get freed up eventually prior to scene changing or the destroy behavior would be pretty pointless.

    2. Depending on your game, recycling may be better on resources for you. Check out the recycling tutorial in the GS Cookbook. Instead of destroying an actor, it's moved off-screen to be recycled again. I don't think recycling is suited or possible for every possible situation so you should test it out for your particular game setup and see if it yields any performance gains.

    - Jeff
Sign In or Register to comment.