File tree Expand file tree Collapse file tree
tests/suite/modules/system_related Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,13 +44,11 @@ public static object isenabled() {
4444 return ScriptingRuntimeHelpers . True ;
4545 }
4646
47- public static int collect ( CodeContext context , int generation ) {
48- return context . LanguageContext . Collect ( generation ) ;
49- }
47+ public static void collect ( CodeContext context , int generation )
48+ => context . LanguageContext . Collect ( generation ) ;
5049
51- public static int collect ( CodeContext context ) {
52- return collect ( context , GC . MaxGeneration ) ;
53- }
50+ public static void collect ( CodeContext context )
51+ => collect ( context , GC . MaxGeneration ) ;
5452
5553 public static void set_debug ( object ? o ) {
5654 throw PythonOps . NotImplementedError ( "gc.set_debug isn't implemented" ) ;
Original file line number Diff line number Diff line change @@ -3232,15 +3232,11 @@ public override IList<string> GetCallSignatures(object obj) {
32323232 /// Performs a GC collection including the possibility of freeing weak data structures held onto by the Python runtime.
32333233 /// </summary>
32343234 /// <param name="generation"></param>
3235- [ System . Diagnostics . CodeAnalysis . SuppressMessage ( "Microsoft.Reliability" , "CA2001:AvoidCallingProblematicMethods" , MessageId = "System.GC.Collect" ) ]
3236- internal int Collect ( int generation ) {
3235+ internal void Collect ( int generation ) {
32373236 if ( generation > GC . MaxGeneration || generation < 0 ) {
32383237 throw PythonOps . ValueError ( "invalid generation {0}" , generation ) ;
32393238 }
32403239
3241- // now let the CLR do it's normal collection
3242- long start = GC . GetTotalMemory ( false ) ;
3243-
32443240 for ( int i = 0 ; i < 2 ; i ++ ) {
32453241 GC . Collect ( generation ) ;
32463242 GC . WaitForPendingFinalizers ( ) ;
@@ -3251,8 +3247,6 @@ internal int Collect(int generation) {
32513247 FunctionCode . CleanFunctionCodes ( this , true ) ;
32523248 }
32533249 }
3254-
3255- return ( int ) Math . Max ( start - GC . GetTotalMemory ( false ) , 0 ) ;
32563250 }
32573251
32583252 public DynamicDelegateCreator DelegateCreator {
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ def test_isenabled(self):
138138
139139 def test_collect (self ):
140140 if is_cli :
141- i = gc .collect () # returns # of bytes collected, could be anything
141+ self . assertIsNone ( gc .collect ()) # returns None, we don't track collected objects
142142 else :
143143 for debug in debug_list :
144144 gc .set_debug (debug )
You can’t perform that action at this time.
0 commit comments