Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit454feda

Browse files
author
James E. Blair
committed
Only gc.collect() under windows
Under Windows, tempfile objects are holding references to open filesuntil the garbage collector closes them and frees them. Explicitcalls to gc.collect() were added to the finalizer for the Repo classto force them to be closed synchronously. However, this is expensive,especially in large, long-running programs. As a temporary measureto alleviate the performance regression on other platforms, onlyperform these calls when running under Windows.Fixes#553
1 parentf237620 commit454feda

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
defclose(self):
210210
ifself.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+
ifis_win:
219+
gc.collect()
213220
gitdb.util.mman.collect()
214-
gc.collect()
221+
ifis_win:
222+
gc.collect()
215223

216224
def__eq__(self,rhs):
217225
ifisinstance(rhs,Repo):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp