• Advertisement
Sign in to follow this  

ARC in Game Programming

This topic is 1424 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

I am sorry if this belongs to "General Programming" instead of "Game Programming", but I was just thinking about something while watching my memory usage for my game go up, and up, and up...

 

It might be just me not fully grasping memory management yet, but I usually don't have much problems with excess memory usage in my general apps.  I had one situation where I had a 9GB file with intense string manipulation, where I had to terminate the program half way through because my program had reached 5GB RAM usage.  I just slapped in an @autorelease inside my tight loop, and the problem was solved.

 

I have a game I am making now that just eats more and more RAM.  I am guessing it is not really to blame ARC, rather me forgetting to release some resources or something, but I still wonder...

 

How is your stance on ARC in games.  How do you go about using (or not using) ARC in your games.  What are the reasons for your choices regarding ARC?

 

Share this post


Link to post
Share on other sites
Advertisement

Thank you for your elaborate answer.  Yes, I am talking about Automatic Reference Counting in Objective C.

 

Given your answer, and my wish for portability, I think I have decided to move back to C++ for this particular project.  Again thanks for your answer.

Share this post


Link to post
Share on other sites


Looks like you are talking about Objective C's Automatic Reference Counting (ARC) garbage collection.

 

There is no such thing.  ARC does not introduce garbage collection.  It is a compile time technology that statically analyses your code and then inserts the correct retains and release mechanisms to manage the life cycle of your objects.  There is no runtime process that manages the deallocation of objects due to ARC and because of this it cannot handle cyclic refferences in the way that garbage collection can.

 

The reason that your memory is going up and up is that somewhere in your program you have a "strong" refference to something that should be "weak".

Share this post


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

  • Advertisement