-
Notifications
You must be signed in to change notification settings - Fork 184
It looks like memory leak in Utf16ValueStringBuilder.Insert #36
Copy link
Copy link
Closed
Description
Original buffer is not released before assigning new buffer
ZString/src/ZString/Utf16ValueStringBuilder.cs
Lines 309 to 314 in 9837975
| int remainLnegth = this.index - index; | |
| buffer.AsSpan(index, remainLnegth).CopyTo(newBuffer.AsSpan(newBufferIndex)); | |
| buffer = newBuffer; | |
| this.index = newBufferIndex + remainLnegth; | |
| } |
For example Grow releases buffer before assigning new one
ZString/src/ZString/Utf16ValueStringBuilder.cs
Lines 139 to 146 in 9837975
| buffer.CopyTo(newBuffer, 0); | |
| if (buffer.Length != ThreadStaticBufferSize) | |
| { | |
| ArrayPool<char>.Shared.Return(buffer); | |
| } | |
| buffer = newBuffer; | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels