Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fixed SzArray from Collectible LoaderAllocator being allocated in fro…
…zen heap
  • Loading branch information
alexey-zakharov committed Mar 29, 2024
commit 9c7cc33d505d9345fb72a77e14140fb318b06269
1 change: 1 addition & 0 deletions src/coreclr/vm/frozenobjectheap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Object* FrozenObjectHeapManager::TryAllocateObject(PTR_MethodTable type, size_t
CrstHolder ch(&m_Crst);

_ASSERT(type != nullptr);
_ASSERT(!type->Collectible());
_ASSERT(FOH_COMMIT_SIZE >= MIN_OBJECT_SIZE);

// Currently we don't support frozen objects with special alignment requirements
Expand Down
6 changes: 4 additions & 2 deletions src/coreclr/vm/gchelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,11 @@ OBJECTREF TryAllocateFrozenSzArray(MethodTable* pArrayMT, INT32 cElements)

CorElementType elemType = pArrayMT->GetArrayElementType();

if (pArrayMT->ContainsPointers() && cElements > 0)
if (pArrayMT->Collectible() || (pArrayMT->ContainsPointers() && cElements > 0))
{
// For arrays with GC pointers we can only work with empty arrays
// We cannot allocate in the frozen heap if:
// - the array type is collectible
// - or for non empty arrays with GC pointers
return NULL;
}

Expand Down