Skip to content

Conversation

@AArnott
Copy link
Collaborator

@AArnott AArnott commented Feb 9, 2023

Fixes a couple possible reasons for running out of memory during a build.

@AArnott AArnott added this to the v3.6 milestone Feb 9, 2023
This should help avoid OOMs thrown when operating on repos with very large git database files.
More importantly, this fixes a leak where `SafeMemoryMappedViewHandle.ReleasePointer` was not getting called in `GitPackIndexMappedReader`. Without calling this, the native memory just leaks until the msbuild.exe process crashes.
@AArnott AArnott enabled auto-merge February 9, 2023 16:07
@AArnott AArnott merged commit 4a207d1 into main Feb 9, 2023
@AArnott AArnott deleted the oomFix branch February 9, 2023 16:31
AArnott added a commit that referenced this pull request Feb 14, 2023
We had been mapping only parts of the index into memory, and shifting the mapped window with each call to `GetSpan`. The problem was the caller would use `GetSpan` more than once, and hold each result such that it had a pointer/span into both windows when only one existed at any given point.

This fixes a regression made in #892 (395dfa7).
In that change, I tried to reduce the mapped file from the whole file to just a window. That was as part of fixing an `OutOfMemoryException`, but ultimately I believe that was due to a memory leak, which that PR also fixed. So in this change I keep the memory leak fix (by releasing the acquired pointer) but revert the smaller, moving window code change.
@adc-cjewett adc-cjewett mentioned this pull request Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants