Skip to content

It looks like memory leak in Utf16ValueStringBuilder.Insert #36

Closed
@martynovs

Description

@martynovs

Original buffer is not released before assigning new buffer

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

buffer.CopyTo(newBuffer, 0);
if (buffer.Length != ThreadStaticBufferSize)
{
ArrayPool<char>.Shared.Return(buffer);
}
buffer = newBuffer;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions