Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredpar committed Mar 5, 2024
1 parent 06b1763 commit d2e8a20
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 20 deletions.
1 change: 0 additions & 1 deletion src/Compilers/Core/Portable/PEWriter/PeWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,6 @@ internal static bool WritePeToStream(
}

peBlob.Free();
managedResourceBuilder?.AssertFreed();

return true;
}
Expand Down
19 changes: 0 additions & 19 deletions src/Compilers/Core/Portable/PEWriter/PooledBlobBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,13 @@ internal sealed class PooledBlobBuilder : BlobBuilder, IDisposable
private const int PoolSize = 128;
private const int PoolChunkSize = 1024;

#if DEBUG
internal bool IsFreed { get; private set; }
#endif

private static readonly ObjectPool<PooledBlobBuilder> s_chunkPool = new ObjectPool<PooledBlobBuilder>(() => new PooledBlobBuilder(PoolChunkSize), PoolSize);

private PooledBlobBuilder(int size)
: base(size)
{
}

[Conditional("DEBUG")]
public void AssertFreed()
{
#if DEBUG
Debug.Assert(IsFreed);
#endif
}

/// <summary>
/// Get a new instance of the <see cref="BlobBuilder"/> that has <see cref="BlobBuilder.ChunkCapacity"/> of
/// at least <see cref="PoolChunkSize"/>
Expand All @@ -53,9 +41,6 @@ public static PooledBlobBuilder GetInstance(bool zero = false)
builder.WriteBytes(0, builder.ChunkCapacity);
builder.Clear();
}
#if DEBUG
builder.IsFreed = false;
#endif
return builder;
}

Expand All @@ -71,10 +56,6 @@ protected override BlobBuilder AllocateChunk(int minimalSize)

protected override void FreeChunk()
{
#if DEBUG
IsFreed = true;
#endif

if (ChunkCapacity != PoolChunkSize)
{
// The invariant of this builder is that it produces BlobBuilder instances that have a
Expand Down

0 comments on commit d2e8a20

Please sign in to comment.