Updated comment in GC.cs about unitialized array.
authorNathan Ricci <naricc@microsoft.com>
Fri, 27 Sep 2019 18:48:00 +0000 (14:48 -0400)
committerNathan Ricci <naricc@microsoft.com>
Fri, 27 Sep 2019 18:48:00 +0000 (14:48 -0400)
Commit migrated from https://github.com/mono/mono/commit/bc63dc68f80d075a544f5fe548abeb9127a60673

src/mono/netcore/System.Private.CoreLib/src/System/GC.cs

index 3b2c5f7..96049a7 100644 (file)
@@ -244,7 +244,11 @@ namespace System
 
                internal static T[] AllocateUninitializedArray<T> (int length)
                {
-                       // TODO: Implement
+                       // Mono only does explicit zeroning if the array is to big for the nursery, but less than 1 Mb - 4 kb.
+                       // If it is bigger than that, we grab memroy directly from the OS which comes pre zeroed.
+                       // Experimentation shows that if we just skip the zeroing in this case, we do not save a measurable
+                       // amount of time. So we just allocate the normal way here.
+                       // Revist if we change LOS implementation.
                        return new T [length];
                }
        }