Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 09b95bf..0416a6a 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -400,6 +400,15 @@
     (void)PyMethod_ClearFreeList();
 }
 
+/* Print summary info about the state of the optimized allocator */
+void
+_PyMethod_DebugMallocStats(FILE *out)
+{
+    _PyDebugAllocatorStats(out,
+                           "free PyMethodObject",
+                           numfree, sizeof(PyMethodObject));
+}
+
 /* ------------------------------------------------------------------------
  * instance method
  */