Skip to content

Fix A/V thrown from while reading the git pack index#894

Merged
AArnott merged 1 commit intomainfrom
dev/andarno/fixAV
Feb 14, 2023
Merged

Fix A/V thrown from while reading the git pack index#894
AArnott merged 1 commit intomainfrom
dev/andarno/fixAV

Conversation

@AArnott
Copy link
Copy Markdown
Collaborator

@AArnott AArnott commented 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.

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.
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.

1 participant