@@ -2615,38 +2615,6 @@ _PyObject_DebugDumpAddress(const void *p)
2615
2615
_PyMem_DumpTraceback (fileno (stderr ), p );
2616
2616
}
2617
2617
2618
- static void
2619
- free_arenas (PyInterpreterState * interp )
2620
- {
2621
- OMState * state = & interp -> obmalloc ;
2622
- for (uint i = 0 ; i < maxarenas ; ++ i ) {
2623
- // free each obmalloc memory arena
2624
- struct arena_object * ao = & allarenas [i ];
2625
- _PyObject_Arena .free (_PyObject_Arena .ctx ,
2626
- (void * )ao -> address , ARENA_SIZE );
2627
- }
2628
- // free the array containing pointers to all arenas
2629
- PyMem_RawFree (allarenas );
2630
- #if WITH_PYMALLOC_RADIX_TREE
2631
- // Free the middle and bottom nodes of the radix tree. These are allocated
2632
- // by arena_map_mark_used() but not freed when arenas are freed.
2633
- for (int i1 = 0 ; i1 < MAP_TOP_LENGTH ; i1 ++ ) {
2634
- arena_map_mid_t * mid = arena_map_root .ptrs [i1 ];
2635
- if (mid == NULL ) {
2636
- continue ;
2637
- }
2638
- for (int i2 = 0 ; i2 < MAP_MID_LENGTH ; i2 ++ ) {
2639
- arena_map_bot_t * bot = arena_map_root .ptrs [i1 ]-> ptrs [i2 ];
2640
- if (bot == NULL ) {
2641
- continue ;
2642
- }
2643
- PyMem_RawFree (bot );
2644
- }
2645
- PyMem_RawFree (mid );
2646
- }
2647
- #endif
2648
- }
2649
-
2650
2618
static size_t
2651
2619
printone (FILE * out , const char * msg , size_t value )
2652
2620
{
@@ -2700,6 +2668,40 @@ _PyDebugAllocatorStats(FILE *out,
2700
2668
2701
2669
#ifdef WITH_PYMALLOC
2702
2670
2671
+ static void
2672
+ free_arenas (PyInterpreterState * interp )
2673
+ {
2674
+ OMState * state = & interp -> obmalloc ;
2675
+ for (uint i = 0 ; i < maxarenas ; ++ i ) {
2676
+ // free each obmalloc memory arena
2677
+ struct arena_object * ao = & allarenas [i ];
2678
+ _PyObject_Arena .free (_PyObject_Arena .ctx ,
2679
+ (void * )ao -> address , ARENA_SIZE );
2680
+ }
2681
+ // free the array containing pointers to all arenas
2682
+ PyMem_RawFree (allarenas );
2683
+ #if WITH_PYMALLOC_RADIX_TREE
2684
+ #ifdef USE_INTERIOR_NODES
2685
+ // Free the middle and bottom nodes of the radix tree. These are allocated
2686
+ // by arena_map_mark_used() but not freed when arenas are freed.
2687
+ for (int i1 = 0 ; i1 < MAP_TOP_LENGTH ; i1 ++ ) {
2688
+ arena_map_mid_t * mid = arena_map_root .ptrs [i1 ];
2689
+ if (mid == NULL ) {
2690
+ continue ;
2691
+ }
2692
+ for (int i2 = 0 ; i2 < MAP_MID_LENGTH ; i2 ++ ) {
2693
+ arena_map_bot_t * bot = arena_map_root .ptrs [i1 ]-> ptrs [i2 ];
2694
+ if (bot == NULL ) {
2695
+ continue ;
2696
+ }
2697
+ PyMem_RawFree (bot );
2698
+ }
2699
+ PyMem_RawFree (mid );
2700
+ }
2701
+ #endif
2702
+ #endif
2703
+ }
2704
+
2703
2705
#ifdef Py_DEBUG
2704
2706
/* Is target in the list? The list is traversed via the nextpool pointers.
2705
2707
* The list may be NULL-terminated, or circular. Return 1 if target is in
0 commit comments