diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2017-10-31 11:49:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-31 11:49:16 +0100 |
commit | 0d6968197857d7ca7911cfd07925cf0a079b41fa (patch) | |
tree | de81dcaa714eecce25654927415cf4c65ce16821 /plumbing | |
parent | 50732e34e5304e3a32e87a8937faad4d7b845e50 (diff) | |
parent | 1e9ad3e22a57323ec3b8981d5c6128804904f21a (diff) | |
download | go-git-0d6968197857d7ca7911cfd07925cf0a079b41fa.tar.gz |
Merge pull request #632 from keybase/strib/cleanup-index-map
packfile: delete index maps from memory when no longer needed
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/format/packfile/delta_selector.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plumbing/format/packfile/delta_selector.go b/plumbing/format/packfile/delta_selector.go index 77573ac..51adcdf 100644 --- a/plumbing/format/packfile/delta_selector.go +++ b/plumbing/format/packfile/delta_selector.go @@ -227,6 +227,12 @@ func (dw *deltaSelector) walk( ) error { indexMap := make(map[plumbing.Hash]*deltaIndex) for i := 0; i < len(objectsToPack); i++ { + // Clean up the index map for anything outside our pack + // window, to save memory. + if i > int(packWindow) { + delete(indexMap, objectsToPack[i-int(packWindow)].Hash()) + } + target := objectsToPack[i] // If we already have a delta, we don't try to find a new one for this |