Your comments

I appreciate the intent. But there are still a few point of miscommunication. 

2) We're using uLink framework for networking, it uses obfuscation and produces GCs on update. We're using CoherentUI for our UI, and isn't innocent either. And we have more frameworks. Those are the black boxes I meant, that we have no control over, like Unity.

3) Let's forget foreach, it's minor compared to the rest of the hurdles we encounter working on the old Mono version. My point was you make it sound as easy as hunting a few foreach, and caching variable (which we did). But when you realize a simple MyEvent += MyMethod (or -=) procudes GC, it does change your whole architecture, and since it is optimization, you generally realize that too late late in the process.  

4) You have a different conception of what memory leak is in a managed environment than me. GC can only collect what have been released. In my definition a leak is when the memory grows until OOM (so constant allocation never released unknowingly by the coder). I'm not contesting we have GC being produced.

5) Well to shed some light we have well over 300k+ loc, and ... 2 coders ;) I do like your suggestion of running in an isolated environment, but realistically it is not currently doable with the resources at hand.


And I also appreciate the wish to help. If you're really confident in your ability to fix the issue(s), with the constraint we have (we are stuck at 5.4 for the time being), you can always PM me for further discussion :)


Hi Kanakotka.

The subject have been discussed countless time, and as such I will be brief here.

1) The game is coded in C#, so there is no "before proper GC"

2) Big project end up using multiple framework, which are black boxes that might generate GC without us easily knowing (Unity being one)

3) You mention foreach for example. It's such a simple language feature yet actually improperly handled by mono and produces GC. It shows that "the bed on which we lie" is not very comfy right. And the list on those incorrect handling goes forever. A simple event subscription ? Mono considers it needs to regenerate the full list of subscriber, producing GC. A simple access to direct property of Unity, like transform ? A GC is produced for marshaling the ref from their native code.

4) You mention leak. People have played for more than 4h straight without OOM. I'm not saying it is not possible to trigger one, I'm sure some unfortunate scenario might, but we can park this one at least.

5) Have you ever tried to profile a game of this scale with Unity tools ? Probably not by the sound of it. The profiling just become unresponsive after a certain amount of nested calls. And due to the code architecture we have, there is quickly too many nesting for it. Not to mention the constant crashing it produces. Or the fact that Memory snap never worked for us.


So we tried cleanup routine. There is no "new" in update, there is no foreach used anymore. We're using pooling as much as we can. We had optimization sprints. I'm not saying we're perfect. There is no doubt room for improvement. But due to the nature and the scale of the project, those point you mentioned are very far from being as simple as you make it sounds like.