File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -227,10 +227,13 @@ def __exit__(
227227 value : typing .Optional [BaseException ],
228228 traceback : typing .Optional [types .TracebackType ],
229229 ) -> bool :
230+ self .close ()
231+ return False
232+
233+ def close (self ):
230234 if self .inner is not None :
231235 self .inner .close ()
232236 self .inner = None
233- return False
234237
235238 def solve (
236239 self ,
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ authors = [
88]
99requires-python = " >=3.9"
1010dependencies = [" requests>=1.26" ]
11- version = " 4.2.0 "
11+ version = " 4.2.1 "
1212
1313[project .urls ]
1414homepage = " https://github.com/neuromorphicsystems/astrometry/"
Original file line number Diff line number Diff line change @@ -63,11 +63,11 @@ def size_to_string(size: int) -> str:
6363 )
6464 assert solution .has_match ()
6565 del solution
66- memory_sample = process .memory_full_info ().uss
67- memory_samples [index ] = memory_sample
68- print (
69- f"(repeated solver allocation with context manager) solve { index + 1 } / { SOLVES } , memory usage: { size_to_string (memory_sample )} "
70- )
66+ memory_sample = process .memory_full_info ().uss
67+ memory_samples [index ] = memory_sample
68+ print (
69+ f"(repeated solver allocation with context manager) solve { index + 1 } / { SOLVES } , memory usage: { size_to_string (memory_sample )} "
70+ )
7171deltas = numpy .diff (memory_samples )
7272repeated_solver_allocation_with_context_manager_leak = (
7373 size_to_string (int (numpy .min (deltas [deltas >= 0 ]))),
@@ -91,6 +91,7 @@ def size_to_string(size: int) -> str:
9191 solution_parameters = astrometry .SolutionParameters (),
9292 )
9393 assert solution .has_match ()
94+ solver .close ()
9495 del solution
9596 del solver
9697 memory_sample = process .memory_full_info ().uss
@@ -157,6 +158,7 @@ def size_to_string(size: int) -> str:
157158 ),
158159 )
159160 del solution
161+ del stars
160162 memory_sample = process .memory_full_info ().uss
161163 memory_samples [index ] = memory_sample
162164 print (
You can’t perform that action at this time.
0 commit comments