File tree Expand file tree Collapse file tree 3 files changed +4
-6
lines changed
Expand file tree Collapse file tree 3 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -240,7 +240,6 @@ static inline void _PyObject_GC_TRACK(
240240
241241 PyInterpreterState * interp = _PyInterpreterState_GET ();
242242 PyGC_Head * generation0 = & interp -> gc .young .head ;
243- interp -> gc .young .count ++ ; /* number of tracked GC objects */
244243 PyGC_Head * last = (PyGC_Head * )(generation0 -> _gc_prev );
245244 _PyGCHead_SET_NEXT (last , gc );
246245 _PyGCHead_SET_PREV (gc , last );
@@ -281,10 +280,6 @@ static inline void _PyObject_GC_UNTRACK(
281280 _PyGCHead_SET_PREV (next , prev );
282281 gc -> _gc_next = 0 ;
283282 gc -> _gc_prev &= _PyGC_PREV_MASK_FINALIZED ;
284- PyInterpreterState * interp = _PyInterpreterState_GET ();
285- if (interp -> gc .young .count > 0 ) {
286- interp -> gc .young .count -- ;
287- }
288283#endif
289284}
290285
Original file line number Diff line number Diff line change @@ -156,7 +156,6 @@ _PyTuple_MaybeUntrack(PyObject *op)
156156 _PyObject_GC_UNTRACK (op );
157157}
158158
159- //
160159static bool
161160tuple_need_tracking (PyTupleObject * self )
162161{
Original file line number Diff line number Diff line change @@ -2296,6 +2296,7 @@ _PyObject_GC_Link(PyObject *op)
22962296 GCState * gcstate = & tstate -> interp -> gc ;
22972297 gc -> _gc_next = 0 ;
22982298 gc -> _gc_prev = 0 ;
2299+ gcstate -> young .count ++ ; /* number of allocated GC objects */
22992300 gcstate -> heap_size ++ ;
23002301 if (gcstate -> young .count > gcstate -> young .threshold &&
23012302 gcstate -> enabled &&
@@ -2427,6 +2428,9 @@ PyObject_GC_Del(void *op)
24272428#endif
24282429 }
24292430 GCState * gcstate = get_gc_state ();
2431+ if (gcstate -> young .count > 0 ) {
2432+ gcstate -> young .count -- ;
2433+ }
24302434 gcstate -> heap_size -- ;
24312435 PyObject_Free (((char * )op )- presize );
24322436}
You can’t perform that action at this time.
0 commit comments