Skip to content

Commit be703ac

Browse files
committed
Only clear memory in debug mode
1 parent 377bcb2 commit be703ac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

UnmanagedStringPool.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,12 @@ public void Clear()
217217
{
218218
ObjectDisposedException.ThrowIf(IsDisposed, typeof(UnmanagedStringPool));
219219

220-
// Clear the allocated memory
220+
#if DEBUG
221+
// Clear the allocated memory for debugging
221222
unsafe {
222223
NativeMemory.Clear(basePtr.ToPointer(), (nuint)capacityBytes);
223224
}
225+
#endif
224226

225227
// Reset offset to start of pool
226228
offsetFromBase = 0;

0 commit comments

Comments
 (0)