Fragmentation issues with unmanaged memory access

Are you asking about how Unity’s migration to CoreCLR is happening, or how CoreCLR is devoid of C/C++ interface ?

For the former, the links are these.

For the latter, the links are these.

Native memory allocators - yes, thanks for pointing that out !! It was a miss on my part. Native memory allocators are indeed pretty efficient, n at least some of them probably restrict fragmentations to internal fragmentation only. I’ll study them again.

Do you know which Unity weblink mentions this - being discouraging from making lots of small allocations because it could cause fragmentation ? Or are you drawing general conclusion based on fragmentation issues in C++ platforms ? A typical game match can last anywhere from 20 minutes to 2 hours, or may be more. It seems like it’s bound to have many allocations for many native types. I don’t know if majority/all of them can be made to not be short-lived. Although, I’ll have to say that my knowledge on the subject is neither very deep-rooted nor based on experience.

Yes, given that that’s the only way to allocate native memory anyway.

I’m not sure about this statement. Fragmentation issues occur in all kinds of memory access - managed and unmanaged. The managed memory platforms like .NET CoreCLR handle it via a two-fold solution - (1) trackable two-component allocator-collector model, and (2) post-collection compaction. Compaction is available only to an extent (e.g., Large Object Heap allocations in .NET CoreCLR have limited to no compaction mechanisms). The native memory allocators for unmanaged memory in Unity probably address (1) here, limiting to internal fragmentation only at least for temporary allocators. Though there’s no current workaround for addressing (2) in Unity - the compaction aspect. And without it, over the duration of a typical game session/match time, the native memory could probably still get fragmented. Given that C++ platform users are still researching on potential solutions to this problem, it seems to me that unmanaged/native memory access has the exact same set of issues regardless of which platform/framework accesses them.