From 6e1ffb168bc10339483f3b39e8e519c6d165f0a0 Mon Sep 17 00:00:00 2001 From: Victor Nova Date: Sun, 26 Dec 2021 17:04:02 -0800 Subject: [PATCH] when process is exiting, there's no need to save live .NET objects as they won't be resurrected --- src/runtime/pythonengine.cs | 1 + src/runtime/runtime.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/pythonengine.cs b/src/runtime/pythonengine.cs index c93443025..1338e2631 100644 --- a/src/runtime/pythonengine.cs +++ b/src/runtime/pythonengine.cs @@ -296,6 +296,7 @@ static void OnDomainUnload(object _, EventArgs __) static void OnProcessExit(object _, EventArgs __) { + Runtime.ProcessIsTerminating = true; Shutdown(); } diff --git a/src/runtime/runtime.cs b/src/runtime/runtime.cs index 1db86bc49..a2ee45e9c 100644 --- a/src/runtime/runtime.cs +++ b/src/runtime/runtime.cs @@ -92,6 +92,7 @@ internal static int GetRun() } internal static bool HostedInPython; + internal static bool ProcessIsTerminating; /// Initialize the runtime... /// @@ -254,7 +255,7 @@ internal static void Shutdown() var state = PyGILState_Ensure(); - if (!HostedInPython) + if (!HostedInPython && !ProcessIsTerminating) { // avoid saving dead objects TryCollectingGarbage(runs: 3); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy