Skip to content

Commit

Permalink
GcInfoEncoder: Initialize the BitArrays tracking liveness (dotnet/cor…
Browse files Browse the repository at this point in the history
…eclr#8485)

The non-X86 GcInfoEncoder library uses two bit-arrays to keep track
of pointer-liveness. The BitArrays are allocated using the arena allocator
which doesn't zero-initialize them. This was causing non-deterministic
redundant allocation of unused slots. This change fixes the problem.

Commit migrated from dotnet/coreclr@12c3a06
  • Loading branch information
swaroop-sridhar authored Dec 7, 2016
1 parent bb75a10 commit e115718
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/coreclr/src/gcinfo/gcinfoencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,8 @@ void GcInfoEncoder::Build()
int size_tCount = (m_NumSlots + BITS_PER_SIZE_T - 1) / BITS_PER_SIZE_T;
BitArray liveState(m_pAllocator, size_tCount);
BitArray couldBeLive(m_pAllocator, size_tCount);

liveState.ClearAll();
couldBeLive.ClearAll();

#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
_ASSERTE(m_NumCallSites == 0 || m_pCallSites != NULL);
Expand Down

0 comments on commit e115718

Please sign in to comment.