@@ -278,7 +278,8 @@ internal static void Shutdown()
278278 ClearClrModules ( ) ;
279279 RemoveClrRootModule ( ) ;
280280
281- TryCollectingGarbage ( MaxCollectRetriesOnShutdown , forceBreakLoops : true ) ;
281+ TryCollectingGarbage ( MaxCollectRetriesOnShutdown , forceBreakLoops : true ,
282+ obj : true , derived : false , buffer : false ) ;
282283
283284 NullGCHandles ( ExtensionType . loadedExtensions ) ;
284285 ClassManager . RemoveClasses ( ) ;
@@ -329,7 +330,8 @@ internal static void Shutdown()
329330
330331 const int MaxCollectRetriesOnShutdown = 20 ;
331332 internal static int _collected ;
332- static bool TryCollectingGarbage ( int runs , bool forceBreakLoops )
333+ static bool TryCollectingGarbage ( int runs , bool forceBreakLoops ,
334+ bool obj = true , bool derived = true , bool buffer = true )
333335 {
334336 if ( runs <= 0 ) throw new ArgumentOutOfRangeException ( nameof ( runs ) ) ;
335337
@@ -342,7 +344,9 @@ static bool TryCollectingGarbage(int runs, bool forceBreakLoops)
342344 GC . Collect ( ) ;
343345 GC . WaitForPendingFinalizers ( ) ;
344346 pyCollected += PyGC_Collect ( ) ;
345- pyCollected += Finalizer . Instance . DisposeAll ( ) ;
347+ pyCollected += Finalizer . Instance . DisposeAll ( disposeObj : obj ,
348+ disposeDerived : derived ,
349+ disposeBuffer : buffer ) ;
346350 }
347351 if ( Volatile . Read ( ref _collected ) == 0 && pyCollected == 0 )
348352 {
0 commit comments