You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a number of places in the storage layer, GC.AllocateArray is used to allocate an array on the pinned heap, followed shortly by an Array.Clear. This is redundant, since GC.AllocateArray pre-initializes the data to zero. I'm guessing this might be a hangover from a previous unmanaged allocator, or from migration from a C/C++ implementation.
If the intent is to use unitialized data in the oversized portion: GC.AllocateUnitializedArray exists (but only works for blittable types); otherwise and probably simpler to grok (and easier to validate correctness): just remove the Array.Clear calls, leaving the default/inbuilt zero initialize (i.e. do not switch to GC.AllocateUninitializedArray).
impact: performance
examples:
BlittableFrame.Allocate
MallocFixedPageSize.InternalAllocate (2 of)
SpanByteAllocator.AllocatePage
similar with simple array creation (no GC alloc):
GenericAllocator<,>.AllocatePage
GenericFrame<,>.Allocate
The text was updated successfully, but these errors were encountered:
In a number of places in the storage layer,
GC.AllocateArray
is used to allocate an array on the pinned heap, followed shortly by anArray.Clear
. This is redundant, sinceGC.AllocateArray
pre-initializes the data to zero. I'm guessing this might be a hangover from a previous unmanaged allocator, or from migration from a C/C++ implementation.If the intent is to use unitialized data in the oversized portion:
GC.AllocateUnitializedArray
exists (but only works for blittable types); otherwise and probably simpler to grok (and easier to validate correctness): just remove theArray.Clear
calls, leaving the default/inbuilt zero initialize (i.e. do not switch toGC.AllocateUninitializedArray
).impact: performance
examples:
BlittableFrame.Allocate
MallocFixedPageSize.InternalAllocate
(2 of)SpanByteAllocator.AllocatePage
similar with simple array creation (no GC alloc):
GenericAllocator<,>.AllocatePage
GenericFrame<,>.Allocate
The text was updated successfully, but these errors were encountered: