the 1st step is performed automatically for you, so in a C++ class
constructor you would start directly with PyObject_Init/InitVar. */
-/* This function returns the number of allocated memory blocks, regardless of size */
-PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
-
-/* Macros */
-#ifdef WITH_PYMALLOC
-PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out);
-#endif
-
typedef struct {
/* user context passed as the first argument to the 2 functions */
extern int _PyObject_IsInstanceDictEmpty(PyObject *);
extern PyObject* _PyType_GetSubclasses(PyTypeObject *);
+/* This function returns the number of allocated memory blocks, regardless of size */
+PyAPI_FUNC(Py_ssize_t) _Py_GetAllocatedBlocks(void);
+
+/* Macros */
+#ifdef WITH_PYMALLOC
+// Export the symbol for the 3rd party guppy3 project
+PyAPI_FUNC(int) _PyObject_DebugMallocStats(FILE *out);
+#endif
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+Move _Py_GetAllocatedBlocks() and _PyObject_DebugMallocStats() private
+functions to the internal C API. Patch by Victor Stinner.
/* Defined in tracemalloc.c */
extern void _PyMem_DumpTraceback(int fd, const void *ptr);
+// Forward declaration
+int _PyObject_DebugMallocStats(FILE *out);
+
/* Python's malloc wrappers (see pymem.h) */
const char *opt = Py_GETENV("PYTHONMALLOCSTATS");
debug_stats = (opt != NULL && *opt != '\0');
}
- if (debug_stats)
+ if (debug_stats) {
_PyObject_DebugMallocStats(stderr);
+ }
if (unused_arena_objects == NULL) {
uint i;