Commit d50fd571 by Carlos Martín Nieto

mwindow: free unused windows if we fail to mmap

The first time may be due to memory fragmentation or just bad luck on a
32-bit system. When we hit the mmap error for the first time, free up
the unused windows and try again.
parent c68044a8
......@@ -296,9 +296,19 @@ static git_mwindow *new_window(
*/
if (git_futils_mmap_ro(&w->window_map, fd, w->offset, (size_t)len) < 0) {
/*
* The first error might be down to memory fragmentation even if
* we're below our soft limits, so free up what we can and try again.
*/
while (git_mwindow_close_lru(mwf) == 0)
/* nop */;
if (git_futils_mmap_ro(&w->window_map, fd, w->offset, (size_t)len) < 0) {
git__free(w);
return NULL;
}
}
ctl->mmap_calls++;
ctl->open_windows++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment