Skip to content

Commit 0533dd6

Browse files
committed
Perform the first gc.collect before clearing cache
In issue gitpython-developers#553 it was originally mentioned that the gc.collect was required before clearing the cache, but in the code the collect happens after the cache clear. Move the first gc.collect to before the cache to be consistent with the original description.
1 parent 60ca325 commit 0533dd6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: git/repo/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,10 @@ def __del__(self):
199199

200200
def close(self):
201201
if self.git:
202-
self.git.clear_cache()
203202
if self._gc_on_close:
204203
gc.collect()
204+
self.git.clear_cache()
205+
if self._gc_on_close:
205206
gitdb.util.mman.collect()
206207
gc.collect()
207208

0 commit comments

Comments
 (0)