| |
@@ -1,7 +1,46 @@
|
| |
- diff -up Python-2.7.2/Include/dictobject.h.add-debug-malloc-stats Python-2.7.2/Include/dictobject.h
|
| |
- --- Python-2.7.2/Include/dictobject.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/dictobject.h 2011-09-16 19:03:25.105821625 -0400
|
| |
- @@ -150,6 +150,8 @@ PyAPI_FUNC(PyObject *) PyDict_GetItemStr
|
| |
+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
| |
+ From: Fedora Python maintainers <python-devel@lists.fedoraproject.org>
|
| |
+ Date: Wed, 15 Jul 2020 15:37:52 +0200
|
| |
+ Subject: [PATCH] 00147-add-debug-malloc-stats.patch
|
| |
+
|
| |
+ 00147 #
|
| |
+ Add a sys._debugmallocstats() function
|
| |
+ Based on patch 202 from RHEL 5's python.spec, with updates from rhbz#737198
|
| |
+ Sent upstream as http://bugs.python.org/issue14785
|
| |
+ ---
|
| |
+ Include/dictobject.h | 2 ++
|
| |
+ Include/floatobject.h | 1 +
|
| |
+ Include/frameobject.h | 2 ++
|
| |
+ Include/intobject.h | 2 ++
|
| |
+ Include/listobject.h | 2 ++
|
| |
+ Include/methodobject.h | 4 +++
|
| |
+ Include/object.h | 7 ++++
|
| |
+ Include/objimpl.h | 2 +-
|
| |
+ Include/stringobject.h | 2 ++
|
| |
+ Include/unicodeobject.h | 2 ++
|
| |
+ Lib/test/test_sys.py | 26 ++++++++++++++
|
| |
+ Objects/classobject.c | 9 +++++
|
| |
+ Objects/dictobject.c | 9 +++++
|
| |
+ Objects/floatobject.c | 16 +++++++++
|
| |
+ Objects/frameobject.c | 10 ++++++
|
| |
+ Objects/intobject.c | 17 +++++++++
|
| |
+ Objects/listobject.c | 9 +++++
|
| |
+ Objects/methodobject.c | 9 +++++
|
| |
+ Objects/object.c | 17 +++++++++
|
| |
+ Objects/obmalloc.c | 80 +++++++++++++++++++++++------------------
|
| |
+ Objects/setobject.c | 10 ++++++
|
| |
+ Objects/stringobject.c | 40 +++++++++++++++++++++
|
| |
+ Objects/tupleobject.c | 16 +++++++++
|
| |
+ Objects/unicodeobject.c | 6 ++++
|
| |
+ Python/pythonrun.c | 2 +-
|
| |
+ Python/sysmodule.c | 53 +++++++++++++++++++++++++++
|
| |
+ 26 files changed, 319 insertions(+), 36 deletions(-)
|
| |
+
|
| |
+ diff --git a/Include/dictobject.h b/Include/dictobject.h
|
| |
+ index 5a1e9feea13..da89cec6362 100644
|
| |
+ --- a/Include/dictobject.h
|
| |
+ +++ b/Include/dictobject.h
|
| |
+ @@ -154,6 +154,8 @@ PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
|
| |
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
|
| |
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
|
| |
|
| |
@@ -10,10 +49,11 @@
|
| |
#ifdef __cplusplus
|
| |
}
|
| |
#endif
|
| |
- diff -up Python-2.7.2/Include/floatobject.h.add-debug-malloc-stats Python-2.7.2/Include/floatobject.h
|
| |
- --- Python-2.7.2/Include/floatobject.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/floatobject.h 2011-09-16 19:03:25.106821625 -0400
|
| |
- @@ -132,6 +132,7 @@ PyAPI_FUNC(PyObject *) _PyFloat_FormatAd
|
| |
+ diff --git a/Include/floatobject.h b/Include/floatobject.h
|
| |
+ index 54e88256a2e..33c6ac0d78f 100644
|
| |
+ --- a/Include/floatobject.h
|
| |
+ +++ b/Include/floatobject.h
|
| |
+ @@ -132,6 +132,7 @@ PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
|
| |
failure. Used in builtin_round in bltinmodule.c. */
|
| |
PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits);
|
| |
|
| |
@@ -21,10 +61,11 @@
|
| |
|
| |
|
| |
#ifdef __cplusplus
|
| |
- diff -up Python-2.7.2/Include/frameobject.h.add-debug-malloc-stats Python-2.7.2/Include/frameobject.h
|
| |
- --- Python-2.7.2/Include/frameobject.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/frameobject.h 2011-09-16 19:03:25.107821625 -0400
|
| |
- @@ -80,6 +80,8 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(Py
|
| |
+ diff --git a/Include/frameobject.h b/Include/frameobject.h
|
| |
+ index 34603794c65..db89a4af05b 100644
|
| |
+ --- a/Include/frameobject.h
|
| |
+ +++ b/Include/frameobject.h
|
| |
+ @@ -80,6 +80,8 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
|
| |
|
| |
PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
|
| |
|
| |
@@ -33,10 +74,11 @@
|
| |
/* Return the line of code the frame is currently executing. */
|
| |
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
|
| |
|
| |
- diff -up Python-2.7.2/Include/intobject.h.add-debug-malloc-stats Python-2.7.2/Include/intobject.h
|
| |
- --- Python-2.7.2/Include/intobject.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/intobject.h 2011-09-16 19:03:25.107821625 -0400
|
| |
- @@ -74,6 +74,8 @@ PyAPI_FUNC(PyObject *) _PyInt_FormatAdva
|
| |
+ diff --git a/Include/intobject.h b/Include/intobject.h
|
| |
+ index d1985748b3e..60cb9e0c44b 100644
|
| |
+ --- a/Include/intobject.h
|
| |
+ +++ b/Include/intobject.h
|
| |
+ @@ -78,6 +78,8 @@ PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj,
|
| |
char *format_spec,
|
| |
Py_ssize_t format_spec_len);
|
| |
|
| |
@@ -45,10 +87,11 @@
|
| |
#ifdef __cplusplus
|
| |
}
|
| |
#endif
|
| |
- diff -up Python-2.7.2/Include/listobject.h.add-debug-malloc-stats Python-2.7.2/Include/listobject.h
|
| |
- --- Python-2.7.2/Include/listobject.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/listobject.h 2011-09-16 19:03:25.107821625 -0400
|
| |
- @@ -62,6 +62,8 @@ PyAPI_FUNC(PyObject *) _PyList_Extend(Py
|
| |
+ diff --git a/Include/listobject.h b/Include/listobject.h
|
| |
+ index f19b1c5e56c..7fccb477e1e 100644
|
| |
+ --- a/Include/listobject.h
|
| |
+ +++ b/Include/listobject.h
|
| |
+ @@ -62,6 +62,8 @@ PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
|
| |
#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v))
|
| |
#define PyList_GET_SIZE(op) Py_SIZE(op)
|
| |
|
| |
@@ -57,9 +100,10 @@
|
| |
#ifdef __cplusplus
|
| |
}
|
| |
#endif
|
| |
- diff -up Python-2.7.2/Include/methodobject.h.add-debug-malloc-stats Python-2.7.2/Include/methodobject.h
|
| |
- --- Python-2.7.2/Include/methodobject.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/methodobject.h 2011-09-16 19:03:25.108821625 -0400
|
| |
+ diff --git a/Include/methodobject.h b/Include/methodobject.h
|
| |
+ index 6e160b63900..1944517b392 100644
|
| |
+ --- a/Include/methodobject.h
|
| |
+ +++ b/Include/methodobject.h
|
| |
@@ -87,6 +87,10 @@ typedef struct {
|
| |
|
| |
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
|
| |
@@ -71,10 +115,11 @@
|
| |
#ifdef __cplusplus
|
| |
}
|
| |
#endif
|
| |
- diff -up Python-2.7.2/Include/object.h.add-debug-malloc-stats Python-2.7.2/Include/object.h
|
| |
- --- Python-2.7.2/Include/object.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/object.h 2011-09-16 19:03:25.108821625 -0400
|
| |
- @@ -980,6 +980,13 @@ PyAPI_DATA(PyObject *) _PyTrash_delete_l
|
| |
+ diff --git a/Include/object.h b/Include/object.h
|
| |
+ index 807b24188a7..a9d207929e0 100644
|
| |
+ --- a/Include/object.h
|
| |
+ +++ b/Include/object.h
|
| |
+ @@ -1040,6 +1040,13 @@ PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void);
|
| |
_PyTrash_thread_deposit_object((PyObject*)op); \
|
| |
} while (0);
|
| |
|
| |
@@ -88,9 +133,10 @@
|
| |
#ifdef __cplusplus
|
| |
}
|
| |
#endif
|
| |
- diff -up Python-2.7.2/Include/objimpl.h.add-debug-malloc-stats Python-2.7.2/Include/objimpl.h
|
| |
- --- Python-2.7.2/Include/objimpl.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/objimpl.h 2011-09-16 19:03:25.108821625 -0400
|
| |
+ diff --git a/Include/objimpl.h b/Include/objimpl.h
|
| |
+ index cbf6bc3f876..8c14ab801a1 100644
|
| |
+ --- a/Include/objimpl.h
|
| |
+ +++ b/Include/objimpl.h
|
| |
@@ -101,13 +101,13 @@ PyAPI_FUNC(void) PyObject_Free(void *);
|
| |
|
| |
/* Macros */
|
| |
@@ -106,10 +152,11 @@
|
| |
PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes);
|
| |
PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes);
|
| |
PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p);
|
| |
- diff -up Python-2.7.2/Include/stringobject.h.add-debug-malloc-stats Python-2.7.2/Include/stringobject.h
|
| |
- --- Python-2.7.2/Include/stringobject.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/stringobject.h 2011-09-16 19:03:25.109821625 -0400
|
| |
- @@ -204,6 +204,8 @@ PyAPI_FUNC(PyObject *) _PyBytes_FormatAd
|
| |
+ diff --git a/Include/stringobject.h b/Include/stringobject.h
|
| |
+ index 12cc093c629..0a5fbd1c2e7 100644
|
| |
+ --- a/Include/stringobject.h
|
| |
+ +++ b/Include/stringobject.h
|
| |
+ @@ -204,6 +204,8 @@ PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj,
|
| |
char *format_spec,
|
| |
Py_ssize_t format_spec_len);
|
| |
|
| |
@@ -118,9 +165,10 @@
|
| |
#ifdef __cplusplus
|
| |
}
|
| |
#endif
|
| |
- diff -up Python-2.7.2/Include/unicodeobject.h.add-debug-malloc-stats Python-2.7.2/Include/unicodeobject.h
|
| |
- --- Python-2.7.2/Include/unicodeobject.h.add-debug-malloc-stats 2011-06-11 11:46:23.000000000 -0400
|
| |
- +++ Python-2.7.2/Include/unicodeobject.h 2011-09-16 19:03:25.109821625 -0400
|
| |
+ diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
|
| |
+ index 7781f966301..321bd20f2f7 100644
|
| |
+ --- a/Include/unicodeobject.h
|
| |
+ +++ b/Include/unicodeobject.h
|
| |
@@ -1406,6 +1406,8 @@ PyAPI_FUNC(int) _PyUnicode_IsAlpha(
|
| |
Py_UNICODE ch /* Unicode character */
|
| |
);
|
| |
@@ -130,10 +178,11 @@
|
| |
#ifdef __cplusplus
|
| |
}
|
| |
#endif
|
| |
- diff -up Python-2.7.2/Lib/test/test_sys.py.add-debug-malloc-stats Python-2.7.2/Lib/test/test_sys.py
|
| |
- --- Python-2.7.2/Lib/test/test_sys.py.add-debug-malloc-stats 2011-09-16 19:03:25.048821626 -0400
|
| |
- +++ Python-2.7.2/Lib/test/test_sys.py 2011-09-16 19:03:25.110821625 -0400
|
| |
- @@ -473,6 +473,32 @@ class SysModuleTest(unittest.TestCase):
|
| |
+ diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py
|
| |
+ index 9342716272a..331c0e9391e 100644
|
| |
+ --- a/Lib/test/test_sys.py
|
| |
+ +++ b/Lib/test/test_sys.py
|
| |
+ @@ -487,6 +487,32 @@ class SysModuleTest(unittest.TestCase):
|
| |
p.wait()
|
| |
self.assertIn(executable, ["''", repr(sys.executable)])
|
| |
|
| |
@@ -165,11 +214,12 @@
|
| |
+
|
| |
@test.test_support.cpython_only
|
| |
class SizeofTest(unittest.TestCase):
|
| |
-
|
| |
- diff -up Python-2.7.2/Objects/classobject.c.add-debug-malloc-stats Python-2.7.2/Objects/classobject.c
|
| |
- --- Python-2.7.2/Objects/classobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/classobject.c 2011-09-16 19:03:25.110821625 -0400
|
| |
- @@ -2670,3 +2670,12 @@ PyMethod_Fini(void)
|
| |
+
|
| |
+ diff --git a/Objects/classobject.c b/Objects/classobject.c
|
| |
+ index 02d7cfd019b..1c44a4729c9 100644
|
| |
+ --- a/Objects/classobject.c
|
| |
+ +++ b/Objects/classobject.c
|
| |
+ @@ -2691,3 +2691,12 @@ PyMethod_Fini(void)
|
| |
{
|
| |
(void)PyMethod_ClearFreeList();
|
| |
}
|
| |
@@ -182,9 +232,10 @@
|
| |
+ "free PyMethodObject",
|
| |
+ numfree, sizeof(PyMethodObject));
|
| |
+}
|
| |
- diff -up Python-2.7.2/Objects/dictobject.c.add-debug-malloc-stats Python-2.7.2/Objects/dictobject.c
|
| |
- --- Python-2.7.2/Objects/dictobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/dictobject.c 2011-09-16 19:03:25.111821625 -0400
|
| |
+ diff --git a/Objects/dictobject.c b/Objects/dictobject.c
|
| |
+ index c544ecd8c2d..89ca39c97d4 100644
|
| |
+ --- a/Objects/dictobject.c
|
| |
+ +++ b/Objects/dictobject.c
|
| |
@@ -225,6 +225,15 @@ show_track(void)
|
| |
static PyDictObject *free_list[PyDict_MAXFREELIST];
|
| |
static int numfree = 0;
|
| |
@@ -201,10 +252,11 @@
|
| |
void
|
| |
PyDict_Fini(void)
|
| |
{
|
| |
- diff -up Python-2.7.2/Objects/floatobject.c.add-debug-malloc-stats Python-2.7.2/Objects/floatobject.c
|
| |
- --- Python-2.7.2/Objects/floatobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/floatobject.c 2011-09-16 19:03:25.111821625 -0400
|
| |
- @@ -35,6 +35,22 @@ typedef struct _floatblock PyFloatBlock;
|
| |
+ diff --git a/Objects/floatobject.c b/Objects/floatobject.c
|
| |
+ index 5954d39cdb3..02acc8c0611 100644
|
| |
+ --- a/Objects/floatobject.c
|
| |
+ +++ b/Objects/floatobject.c
|
| |
+ @@ -34,6 +34,22 @@ typedef struct _floatblock PyFloatBlock;
|
| |
static PyFloatBlock *block_list = NULL;
|
| |
static PyFloatObject *free_list = NULL;
|
| |
|
| |
@@ -227,10 +279,11 @@
|
| |
static PyFloatObject *
|
| |
fill_free_list(void)
|
| |
{
|
| |
- diff -up Python-2.7.2/Objects/frameobject.c.add-debug-malloc-stats Python-2.7.2/Objects/frameobject.c
|
| |
- --- Python-2.7.2/Objects/frameobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/frameobject.c 2011-09-16 19:03:25.112821625 -0400
|
| |
- @@ -980,3 +980,13 @@ PyFrame_Fini(void)
|
| |
+ diff --git a/Objects/frameobject.c b/Objects/frameobject.c
|
| |
+ index 4c91dd0c084..03a66dc9057 100644
|
| |
+ --- a/Objects/frameobject.c
|
| |
+ +++ b/Objects/frameobject.c
|
| |
+ @@ -1019,3 +1019,13 @@ PyFrame_Fini(void)
|
| |
Py_XDECREF(builtin_object);
|
| |
builtin_object = NULL;
|
| |
}
|
| |
@@ -244,9 +297,10 @@
|
| |
+ numfree, sizeof(PyFrameObject));
|
| |
+}
|
| |
+
|
| |
- diff -up Python-2.7.2/Objects/intobject.c.add-debug-malloc-stats Python-2.7.2/Objects/intobject.c
|
| |
- --- Python-2.7.2/Objects/intobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/intobject.c 2011-09-16 19:03:25.112821625 -0400
|
| |
+ diff --git a/Objects/intobject.c b/Objects/intobject.c
|
| |
+ index 9b27c35d88d..703fa5a5880 100644
|
| |
+ --- a/Objects/intobject.c
|
| |
+ +++ b/Objects/intobject.c
|
| |
@@ -44,6 +44,23 @@ typedef struct _intblock PyIntBlock;
|
| |
static PyIntBlock *block_list = NULL;
|
| |
static PyIntObject *free_list = NULL;
|
| |
@@ -271,9 +325,10 @@
|
| |
static PyIntObject *
|
| |
fill_free_list(void)
|
| |
{
|
| |
- diff -up Python-2.7.2/Objects/listobject.c.add-debug-malloc-stats Python-2.7.2/Objects/listobject.c
|
| |
- --- Python-2.7.2/Objects/listobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/listobject.c 2011-09-16 19:03:25.113821625 -0400
|
| |
+ diff --git a/Objects/listobject.c b/Objects/listobject.c
|
| |
+ index 24eff769c64..38848bd5cf6 100644
|
| |
+ --- a/Objects/listobject.c
|
| |
+ +++ b/Objects/listobject.c
|
| |
@@ -109,6 +109,15 @@ PyList_Fini(void)
|
| |
}
|
| |
}
|
| |
@@ -290,9 +345,10 @@
|
| |
PyObject *
|
| |
PyList_New(Py_ssize_t size)
|
| |
{
|
| |
- diff -up Python-2.7.2/Objects/methodobject.c.add-debug-malloc-stats Python-2.7.2/Objects/methodobject.c
|
| |
- --- Python-2.7.2/Objects/methodobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/methodobject.c 2011-09-16 19:03:25.113821625 -0400
|
| |
+ diff --git a/Objects/methodobject.c b/Objects/methodobject.c
|
| |
+ index c1a99ab2687..ea5df77ae1c 100644
|
| |
+ --- a/Objects/methodobject.c
|
| |
+ +++ b/Objects/methodobject.c
|
| |
@@ -412,6 +412,15 @@ PyCFunction_Fini(void)
|
| |
(void)PyCFunction_ClearFreeList();
|
| |
}
|
| |
@@ -309,10 +365,11 @@
|
| |
/* PyCFunction_New() is now just a macro that calls PyCFunction_NewEx(),
|
| |
but it's part of the API so we need to keep a function around that
|
| |
existing C extensions can call.
|
| |
- diff -up Python-2.7.2/Objects/object.c.add-debug-malloc-stats Python-2.7.2/Objects/object.c
|
| |
- --- Python-2.7.2/Objects/object.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/object.c 2011-09-16 19:04:46.463820849 -0400
|
| |
- @@ -2334,6 +2334,23 @@ PyMem_Free(void *p)
|
| |
+ diff --git a/Objects/object.c b/Objects/object.c
|
| |
+ index 65366b0b351..acef3ce32cd 100644
|
| |
+ --- a/Objects/object.c
|
| |
+ +++ b/Objects/object.c
|
| |
+ @@ -2360,6 +2360,23 @@ PyMem_Free(void *p)
|
| |
PyMem_FREE(p);
|
| |
}
|
| |
|
| |
@@ -336,10 +393,11 @@
|
| |
|
| |
/* These methods are used to control infinite recursion in repr, str, print,
|
| |
etc. Container objects that may recursively contain themselves,
|
| |
- diff -up Python-2.7.2/Objects/obmalloc.c.add-debug-malloc-stats Python-2.7.2/Objects/obmalloc.c
|
| |
- --- Python-2.7.2/Objects/obmalloc.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/obmalloc.c 2011-09-16 19:03:25.114821625 -0400
|
| |
- @@ -508,12 +508,10 @@ static struct arena_object* usable_arena
|
| |
+ diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
|
| |
+ index 2067cf54e74..71da93887cf 100644
|
| |
+ --- a/Objects/obmalloc.c
|
| |
+ +++ b/Objects/obmalloc.c
|
| |
+ @@ -547,12 +547,10 @@ static struct arena_object* usable_arenas = NULL;
|
| |
/* Number of arenas allocated that haven't been free()'d. */
|
| |
static size_t narenas_currently_allocated = 0;
|
| |
|
| |
@@ -352,7 +410,7 @@
|
| |
|
| |
/* Allocate a new arena. If we run out of memory, return NULL. Else
|
| |
* allocate a new arena, and return the address of an arena_object
|
| |
- @@ -528,7 +526,7 @@ new_arena(void)
|
| |
+ @@ -569,7 +567,7 @@ new_arena(void)
|
| |
|
| |
#ifdef PYMALLOC_DEBUG
|
| |
if (Py_GETENV("PYTHONMALLOCSTATS"))
|
| |
@@ -361,7 +419,7 @@
|
| |
#endif
|
| |
if (unused_arena_objects == NULL) {
|
| |
uint i;
|
| |
- @@ -588,11 +586,9 @@ new_arena(void)
|
| |
+ @@ -637,11 +635,9 @@ new_arena(void)
|
| |
arenaobj->address = (uptr)address;
|
| |
|
| |
++narenas_currently_allocated;
|
| |
@@ -373,7 +431,7 @@
|
| |
arenaobj->freepools = NULL;
|
| |
/* pool_address <- first pool-aligned address in the arena
|
| |
nfreepools <- number of whole pools that fit after alignment */
|
| |
- @@ -1694,17 +1690,19 @@ _PyObject_DebugDumpAddress(const void *p
|
| |
+ @@ -1802,17 +1798,19 @@ _PyObject_DebugDumpAddress(const void *p)
|
| |
}
|
| |
}
|
| |
|
| |
@@ -397,7 +455,7 @@
|
| |
|
| |
/* Write the value with commas. */
|
| |
i = 22;
|
| |
- @@ -1725,17 +1723,32 @@ printone(const char* msg, size_t value)
|
| |
+ @@ -1833,17 +1831,32 @@ printone(const char* msg, size_t value)
|
| |
|
| |
while (i >= 0)
|
| |
buf[i--] = ' ';
|
| |
@@ -433,7 +491,7 @@
|
| |
{
|
| |
uint i;
|
| |
const uint numclasses = SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT;
|
| |
- @@ -1764,7 +1777,7 @@ _PyObject_DebugMallocStats(void)
|
| |
+ @@ -1872,7 +1885,7 @@ _PyObject_DebugMallocStats(void)
|
| |
size_t total;
|
| |
char buf[128];
|
| |
|
| |
@@ -442,7 +500,7 @@
|
| |
SMALL_REQUEST_THRESHOLD, numclasses);
|
| |
|
| |
for (i = 0; i < numclasses; ++i)
|
| |
- @@ -1818,10 +1831,10 @@ _PyObject_DebugMallocStats(void)
|
| |
+ @@ -1926,10 +1939,10 @@ _PyObject_DebugMallocStats(void)
|
| |
}
|
| |
assert(narenas == narenas_currently_allocated);
|
| |
|
| |
@@ -455,7 +513,7 @@
|
| |
|
| |
for (i = 0; i < numclasses; ++i) {
|
| |
size_t p = numpools[i];
|
| |
- @@ -1832,7 +1845,7 @@ _PyObject_DebugMallocStats(void)
|
| |
+ @@ -1940,7 +1953,7 @@ _PyObject_DebugMallocStats(void)
|
| |
assert(b == 0 && f == 0);
|
| |
continue;
|
| |
}
|
| |
@@ -464,7 +522,7 @@
|
| |
"%11" PY_FORMAT_SIZE_T "u "
|
| |
"%15" PY_FORMAT_SIZE_T "u "
|
| |
"%13" PY_FORMAT_SIZE_T "u\n",
|
| |
- @@ -1842,36 +1855,35 @@ _PyObject_DebugMallocStats(void)
|
| |
+ @@ -1950,36 +1963,35 @@ _PyObject_DebugMallocStats(void)
|
| |
pool_header_bytes += p * POOL_OVERHEAD;
|
| |
quantization += p * ((POOL_SIZE - POOL_OVERHEAD) % size);
|
| |
}
|
| |
@@ -518,10 +576,11 @@
|
| |
#ifdef Py_USING_MEMORY_DEBUGGER
|
| |
/* Make this function last so gcc won't inline it since the definition is
|
| |
* after the reference.
|
| |
- diff -up Python-2.7.2/Objects/setobject.c.add-debug-malloc-stats Python-2.7.2/Objects/setobject.c
|
| |
- --- Python-2.7.2/Objects/setobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/setobject.c 2011-09-16 19:03:25.115821625 -0400
|
| |
- @@ -1088,6 +1088,16 @@ PySet_Fini(void)
|
| |
+ diff --git a/Objects/setobject.c b/Objects/setobject.c
|
| |
+ index 31da3dbfecb..da086ab2bdb 100644
|
| |
+ --- a/Objects/setobject.c
|
| |
+ +++ b/Objects/setobject.c
|
| |
+ @@ -1087,6 +1087,16 @@ PySet_Fini(void)
|
| |
Py_CLEAR(emptyfrozenset);
|
| |
}
|
| |
|
| |
@@ -538,10 +597,11 @@
|
| |
static PyObject *
|
| |
set_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
| |
{
|
| |
- diff -up Python-2.7.2/Objects/stringobject.c.add-debug-malloc-stats Python-2.7.2/Objects/stringobject.c
|
| |
- --- Python-2.7.2/Objects/stringobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/stringobject.c 2011-09-16 19:03:25.116821625 -0400
|
| |
- @@ -4822,3 +4822,43 @@ void _Py_ReleaseInternedStrings(void)
|
| |
+ diff --git a/Objects/stringobject.c b/Objects/stringobject.c
|
| |
+ index c47d32f4060..b1ffa249745 100644
|
| |
+ --- a/Objects/stringobject.c
|
| |
+ +++ b/Objects/stringobject.c
|
| |
+ @@ -4880,3 +4880,43 @@ void _Py_ReleaseInternedStrings(void)
|
| |
PyDict_Clear(interned);
|
| |
Py_CLEAR(interned);
|
| |
}
|
| |
@@ -585,9 +645,10 @@
|
| |
+ "%zi/%zi "
|
| |
+ "mortal/immortal\n", mortal_size, immortal_size);
|
| |
+}
|
| |
- diff -up Python-2.7.2/Objects/tupleobject.c.add-debug-malloc-stats Python-2.7.2/Objects/tupleobject.c
|
| |
- --- Python-2.7.2/Objects/tupleobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/tupleobject.c 2011-09-16 19:03:25.116821625 -0400
|
| |
+ diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
|
| |
+ index 6f4b18cc5c6..e8e44901589 100644
|
| |
+ --- a/Objects/tupleobject.c
|
| |
+ +++ b/Objects/tupleobject.c
|
| |
@@ -44,6 +44,22 @@ show_track(void)
|
| |
}
|
| |
#endif
|
| |
@@ -611,10 +672,11 @@
|
| |
|
| |
PyObject *
|
| |
PyTuple_New(register Py_ssize_t size)
|
| |
- diff -up Python-2.7.2/Objects/unicodeobject.c.add-debug-malloc-stats Python-2.7.2/Objects/unicodeobject.c
|
| |
- --- Python-2.7.2/Objects/unicodeobject.c.add-debug-malloc-stats 2011-06-11 11:46:27.000000000 -0400
|
| |
- +++ Python-2.7.2/Objects/unicodeobject.c 2011-09-16 19:03:25.118821625 -0400
|
| |
- @@ -8883,6 +8883,12 @@ _PyUnicode_Fini(void)
|
| |
+ diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
|
| |
+ index a859fa05214..b6ff83e110e 100644
|
| |
+ --- a/Objects/unicodeobject.c
|
| |
+ +++ b/Objects/unicodeobject.c
|
| |
+ @@ -9018,6 +9018,12 @@ _PyUnicode_Fini(void)
|
| |
(void)PyUnicode_ClearFreeList();
|
| |
}
|
| |
|
| |
@@ -627,10 +689,11 @@
|
| |
#ifdef __cplusplus
|
| |
}
|
| |
#endif
|
| |
- diff -up Python-2.7.2/Python/pythonrun.c.add-debug-malloc-stats Python-2.7.2/Python/pythonrun.c
|
| |
- --- Python-2.7.2/Python/pythonrun.c.add-debug-malloc-stats 2011-09-16 19:03:25.025821626 -0400
|
| |
- +++ Python-2.7.2/Python/pythonrun.c 2011-09-16 19:03:25.118821625 -0400
|
| |
- @@ -549,7 +549,7 @@ Py_Finalize(void)
|
| |
+ diff --git a/Python/pythonrun.c b/Python/pythonrun.c
|
| |
+ index abdfb146ae5..d9a0e98a9e9 100644
|
| |
+ --- a/Python/pythonrun.c
|
| |
+ +++ b/Python/pythonrun.c
|
| |
+ @@ -562,7 +562,7 @@ Py_Finalize(void)
|
| |
#endif /* Py_TRACE_REFS */
|
| |
#ifdef PYMALLOC_DEBUG
|
| |
if (Py_GETENV("PYTHONMALLOCSTATS"))
|
| |
@@ -639,10 +702,11 @@
|
| |
#endif
|
| |
|
| |
call_ll_exitfuncs();
|
| |
- diff -up Python-2.7.2/Python/sysmodule.c.add-debug-malloc-stats Python-2.7.2/Python/sysmodule.c
|
| |
- --- Python-2.7.2/Python/sysmodule.c.add-debug-malloc-stats 2011-09-16 19:03:25.007821626 -0400
|
| |
- +++ Python-2.7.2/Python/sysmodule.c 2011-09-16 19:03:25.119821625 -0400
|
| |
- @@ -872,6 +872,57 @@ a 11-tuple where the entries in the tupl
|
| |
+ diff --git a/Python/sysmodule.c b/Python/sysmodule.c
|
| |
+ index 22238ba8ce4..95bfb40bee7 100644
|
| |
+ --- a/Python/sysmodule.c
|
| |
+ +++ b/Python/sysmodule.c
|
| |
+ @@ -890,6 +890,57 @@ a 11-tuple where the entries in the tuple are counts of:\n\
|
| |
extern "C" {
|
| |
#endif
|
| |
|
| |
@@ -700,7 +764,7 @@
|
| |
#ifdef Py_TRACE_REFS
|
| |
/* Defined in objects.c because it uses static globals if that file */
|
| |
extern PyObject *_Py_GetObjects(PyObject *, PyObject *);
|
| |
- @@ -970,6 +1021,8 @@ static PyMethodDef sys_methods[] = {
|
| |
+ @@ -988,6 +1039,8 @@ static PyMethodDef sys_methods[] = {
|
| |
{"settrace", sys_settrace, METH_O, settrace_doc},
|
| |
{"gettrace", sys_gettrace, METH_NOARGS, gettrace_doc},
|
| |
{"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
|
| |
To have all the ducks in a row, here's a sync or
python2
withpython2.7
.