Skip to content

Commit 704e94e

Browse files
Heap size should be added at end of the struct
Co-authored-by: Dino Viehland <dinoviehland@meta.com> Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
1 parent 2281499 commit 704e94e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Include/internal/pycore_interp_structs.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ struct _gc_runtime_state {
228228
/* linked lists of container objects */
229229
#ifndef Py_GIL_DISABLED
230230
struct gc_generation generations[NUM_GENERATIONS];
231-
PyGC_Head *generation0;
232231
#else
233232
struct gc_generation young;
234233
struct gc_generation old[2];
235234
#endif
235+
236236
/* a permanent generation which won't be collected */
237237
struct gc_generation permanent_generation;
238238
struct gc_stats *generation_stats;
@@ -249,6 +249,11 @@ struct _gc_runtime_state {
249249
/* The number of live objects. */
250250
Py_ssize_t heap_size;
251251

252+
/* dummy members to preserve other offsets */
253+
Py_ssize_t dummy1; /* was work_to_do */
254+
int dummy2; /* was visited_space */
255+
int dummy3; /* was phase */
256+
252257
/* This is the number of objects that survived the last full
253258
collection. It approximates the number of long lived objects
254259
tracked by the GC.
@@ -274,6 +279,8 @@ struct _gc_runtime_state {
274279

275280
/* Mutex held for gc_should_collect_mem_usage(). */
276281
PyMutex mutex;
282+
#else
283+
PyGC_Head *generation0;
277284
#endif
278285
};
279286

0 commit comments

Comments
 (0)