Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono] IL Strip make sure the MemoryStream is disposed #112142

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lewing
Copy link
Member

@lewing lewing commented Feb 4, 2025

No description provided.

@lewing lewing force-pushed the dispose-memorystream branch from 47b7aa6 to 1b49249 Compare February 4, 2025 19:12
@lewing lewing closed this Feb 4, 2025
@lewing lewing reopened this Feb 4, 2025
@lewing lewing requested a review from steveisok February 4, 2025 19:33
}

private static void ZeroOutMethodBody(ref MemoryStream memStream, int methodSize, int actualLoc, int headerSize)
private static void ZeroOutMethodBody(MemoryStream memStream, int methodSize, int actualLoc, int headerSize)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mapping the region as Span and then Span.Clear will be cheaper than renting new buffer + copy.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be missing something but why are we using a copied MemoryStream at all rather than just directly writing to the FileStream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants