assert(generation >= 0 && generation < NUM_GENERATIONS);
#ifdef Py_STATS
- if (_Py_stats) {
- _Py_stats->object_stats.object_visits = 0;
+ {
+ PyStats *s = _PyStats_GET();
+ if (s) {
+ s->object_stats.object_visits = 0;
+ }
}
#endif
+
GC_STAT_ADD(generation, collections, 1);
struct gc_generation_stats stats = { 0 };
/* Update stats */
add_stats(gcstate, generation, &stats);
- GC_STAT_ADD(generation, objects_collected, m);
+ GC_STAT_ADD(generation, objects_collected, stats.collected);
+
#ifdef Py_STATS
- if (_Py_stats) {
- GC_STAT_ADD(generation, object_visits,
- _Py_stats->object_stats.object_visits);
- _Py_stats->object_stats.object_visits = 0;
+ {
+ PyStats *s = _PyStats_GET();
+ if (s) {
+ GC_STAT_ADD(generation, object_visits,
+ s->object_stats.object_visits);
+ s->object_stats.object_visits = 0;
+ }
}
#endif