Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/coreclr/nativeaot/Runtime/GCHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@ static Object* GcAllocInternal(MethodTable* pEEType, uint32_t uFlags, uintptr_t
ASSERT(!pThread->IsDoNotTriggerGcSet());
ASSERT(pThread->IsCurrentThreadInCooperativeMode());

if (pEEType->ContainsPointers())
{
uFlags |= GC_ALLOC_CONTAINS_REF;
uFlags &= ~GC_ALLOC_ZEROING_OPTIONAL;
}

size_t cbSize = pEEType->GetBaseSize();

if (pEEType->HasComponentSize())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,8 @@ private unsafe static void AllocateArrayPinned_ManagedValueType_CanRoundtripThro
byte* pointer = (byte*)Unsafe.AsPointer(ref array[0]); // Unsafe.AsPointer is safe since array is pinned
var size = Unsafe.SizeOf<EmbeddedValueType<string>>();

GC.Collect();

for(int i = 0; i < length; ++i)
{
int idx = rng.Next(length);
Expand Down