8000 Finalizer.Instance.Collect() and Runtime.TryCollectingGarbage(...) ar… · spsforks/pythonnet-pythonnet@59b1c51 · GitHub
[go: up one dir, main page]

Skip to content

Commit 59b1c51

Browse files
committed
Finalizer.Instance.Collect() and Runtime.TryCollectingGarbage(...) are now callable from Python
1 parent 863397a commit 59b1c51

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/runtime/Finalizer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ internal IncorrectRefCountException(IntPtr ptr)
106106

107107
#endregion
108108

109+
[ForbidPythonThreads]
109110
public void Collect() => this.DisposeAll();
110111

111112
internal void ThrottledCollect()

src/runtime/Runtime.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,7 @@ static bool TryCollectingGarbage(int runs, bool forceBreakLoops)
359359
/// </summary>
360360
/// <param name="runs">Total number of GC loops to run</param>
361361
/// <returns><c>true</c> if a steady state was reached upon the requested number of tries (e.g. on the last try no objects were collected).</returns>
362+
[ForbidPythonThreads]
362363
public static bool TryCollectingGarbage(int runs)
363364
=> TryCollectingGarbage(runs, forceBreakLoops: false);
364365

0 commit comments

Comments
 (0)
0