So, how much of those gains comes from using the equivalent of malloc/free (FTA: “The most dangerous ArrayPool mistake is forgetting to return arrays. Unlike regular arrays that get garbage collected automatically, pooled arrays must be explicitly returned”), and how much from having pools of a memory blocks of various sizes?
If the former is a significant part, wouldn’t it be useful to just add that to .NET? One would need runtime guards to prevent use after free, but I think at least the “alloc temp buffer for use by function” case isn’t a nightmare to implement (for those working on the .NET runtime)
So, how much of those gains comes from using the equivalent of malloc/free (FTA: “The most dangerous ArrayPool mistake is forgetting to return arrays. Unlike regular arrays that get garbage collected automatically, pooled arrays must be explicitly returned”), and how much from having pools of a memory blocks of various sizes?
If the former is a significant part, wouldn’t it be useful to just add that to .NET? One would need runtime guards to prevent use after free, but I think at least the “alloc temp buffer for use by function” case isn’t a nightmare to implement (for those working on the .NET runtime)