Skip to content

Commit c62b47b

Browse files
Move debug_stats to _PyRuntimeState.
1 parent 19f5f29 commit c62b47b

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

Include/internal/pycore_obmalloc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ struct _obmalloc_usage {
658658

659659

660660
struct _obmalloc_state {
661+
int dump_debug_stats;
661662
struct _obmalloc_pools pools;
662663
struct _obmalloc_mgmt mgmt;
663664
struct _obmalloc_usage usage;

Include/internal/pycore_obmalloc_init.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ extern "C" {
5656

5757
#define _obmalloc_state_INIT(obmalloc) \
5858
{ \
59+
.dump_debug_stats = -1, \
5960
.pools = { \
6061
.used = _obmalloc_pools_INIT(obmalloc.pools), \
6162
}, \

Objects/obmalloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,11 +908,12 @@ new_arena(void)
908908
struct arena_object* arenaobj;
909909
uint excess; /* number of bytes above pool alignment */
910910
void *address;
911-
static int debug_stats = -1;
912911

912+
int debug_stats = _PyRuntime.obmalloc.dump_debug_stats;
913913
if (debug_stats == -1) {
914914
const char *opt = Py_GETENV("PYTHONMALLOCSTATS");
915915
debug_stats = (opt != NULL && *opt != '\0');
916+
_PyRuntime.obmalloc.dump_debug_stats = debug_stats;
916917
}
917918
if (debug_stats) {
918919
_PyObject_DebugMallocStats(stderr);

Tools/c-analyzer/cpython/globals-to-fix.tsv

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,6 @@ Objects/sliceobject.c - _Py_EllipsisObject -
305305
##-----------------------
306306
## effectively-const but initialized lazily
307307

308-
## idempotent
309-
Objects/obmalloc.c new_arena debug_stats -
310-
311308
## others
312309
Python/perf_trampoline.c - perf_map_file -
313310

0 commit comments

Comments
 (0)