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

Commitf1a82e4

Browse files
committed
fix(leaks): repo context-man to cleanup global mman on repo-delete
Improve API for problems like#553.
1 parent2f207e0 commitf1a82e4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎git/repo/base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
importos.pathasosp
3434

3535
from .funimportrev_parse,is_git_dir,find_submodule_git_dir,touch
36+
importgc
37+
importgitdb
3638

3739

3840
log=logging.getLogger(__name__)
@@ -177,9 +179,21 @@ def __init__(self, path=None, odbt=DefaultDBType, search_parent_directories=Fals
177179
args.append(self.git)
178180
self.odb=odbt(*args)
179181

182+
def__enter__(self):
183+
returnself
184+
185+
def__exit__(self,exc_type,exc_value,traceback):
186+
self.close()
187+
180188
def__del__(self):
189+
self.close()
190+
191+
defclose(self):
181192
ifself.git:
182193
self.git.clear_cache()
194+
gc.collect()
195+
gitdb.util.mman.collect()
196+
gc.collect()
183197

184198
def__eq__(self,rhs):
185199
ifisinstance(rhs,Repo):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp