4 ms·
Pros: 1. The GC provides a huge time-saving net over a ton of possible memory errors. Not to mention the code is so much easier to read when you aren't having
by hacker_9 9y ago
Pros:
1. The GC provides a huge time-saving net over a ton of possible memory errors. Not to mention the code is so much easier to read when you aren't having to deal with memory on every line.
2. The debugging experience is brilliant - because there is always metadata available, you can literally inspect everything.
3. Compilation time is super fast.
4. Code samples are available for pretty much everything. And when there aren't, you can always interop into C++ or whatever else.
Cons:
People unfamiliar with the language forget about the GC and let it do all their dirty work. They then get angry when it bites back because of all the allocations they are doing each frame. The answer is to use pooling, and structure your code in a way that works with the GC (not against it), and all these problems go away.
- kuschku 9y agoBut that's not the issue - any other GC'd language has a much faster and better GC than this ancient mono version. That was the issue mentioned.
- socialist_coder 9y agoYes, and that complaint is specific to Unity's current GC. They will update it eventually, and it will no longer suck. Does the GC in Unreal-mono have the same problems? If not, it's a non-issue.
- kevingadd 9y agoUnity has a specific situation with Mono that doesn't apply to anything else. It won't apply here, something like this can use the latest Mono.
- tracker1 9y agoIt should be significantly better, but can still pause. Beyond this, it really depends on how you are allocating/using/reusing objects... There are techniques you can use that aren't too painful to overcome some of the issues.
- hacker_9 9y agoThe concurrent GC in the latest .Net still requires pausing (though the time is less), because the heap still requires compacting, and no code can run while that operation happens. Invoking the GC constantly on a frame by frame basis can quickly lead to heap fragmentation, resulting in pausing, because that is considered 'working against' the GC (both stop the world and concurrent). This is where custom solutions, such as pooling, should be used to mitigate these issues.