8000 Merge pull request #686 from jeblair/issue-605 · SaradaNayak/GitPython@bfae362 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bfae362

Browse files
authored
Merge pull request gitpython-developers#686 from jeblair/issue-605
Only gc.collect() under windows
2 parents 4dd14b6 + 454feda commit bfae362

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

git/repo/base.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,17 @@ def __del__(self):
209209
def close(self):
210210
if self.git:
211211
self.git.clear_cache()
212-
gc.collect()
212+
# Tempfiles objects on Windows are holding references to
213+
# open files until they are collected by the garbage
214+
# collector, thus preventing deletion.
215+
# TODO: Find these references and ensure they are closed
216+
# and deleted synchronously rather than forcing a gc
217+
# collection.
218+
if is_win:
219+
gc.collect()
213220
gitdb.util.mman.collect()
214-
gc.collect()
221+
if is_win:
222+
gc.collect()
215223

216224
def __eq__(self, rhs):
217225
if isinstance(rhs, Repo):

0 commit comments

Comments
 (0)
0