1*c29d5175SchristosFollowing are examples of running py_mallocstk.d. This traces malloc() from 2*c29d5175SchristosPython, printing byte distributions by user stack trace. 3*c29d5175Schristos 4*c29d5175SchristosHere we see the script runnin on the program Code/Python/func_abc.py 5*c29d5175Schristos 6*c29d5175Schristos# py_mallocstk.d -c ./func_abc.py 7*c29d5175Schristos 8*c29d5175SchristosTracing... Hit Ctrl-C to end. 9*c29d5175SchristosFunction A 10*c29d5175SchristosFunction B 11*c29d5175SchristosFunction C 12*c29d5175Schristos 13*c29d5175SchristosPython malloc byte distributions by stack trace, 14*c29d5175Schristos 15*c29d5175Schristos 16*c29d5175Schristos 17*c29d5175Schristos libc.so.1`malloc 18*c29d5175Schristos libpython2.4.so.1.0`r_object+0x52f 19*c29d5175Schristos libpython2.4.so.1.0`r_object+0x491 20*c29d5175Schristos libpython2.4.so.1.0`r_object+0xd3 21*c29d5175Schristos libpython2.4.so.1.0`r_object+0x491 22*c29d5175Schristos libpython2.4.so.1.0`r_object+0xd3 23*c29d5175Schristos libpython2.4.so.1.0`r_object+0x491 24*c29d5175Schristos libpython2.4.so.1.0`r_object+0xd3 25*c29d5175Schristos libpython2.4.so.1.0`PyMarshal_ReadObjectFromString+0x36 26*c29d5175Schristos libpython2.4.so.1.0`PyMarshal_ReadLastObjectFromFile+0x6a 27*c29d5175Schristos libpython2.4.so.1.0`read_compiled_module+0xf 28*c29d5175Schristos libpython2.4.so.1.0`load_source_module+0x63 29*c29d5175Schristos libpython2.4.so.1.0`load_module+0xac 30*c29d5175Schristos libpython2.4.so.1.0`import_submodule+0xfb 31*c29d5175Schristos libpython2.4.so.1.0`load_next+0xee 32*c29d5175Schristos libpython2.4.so.1.0`import_module_ex+0x48 33*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d 34*c29d5175Schristos libpython2.4.so.1.0`builtin___import__+0x4e 35*c29d5175Schristos libpython2.4.so.1.0`PyCFunction_Call+0x15f 36*c29d5175Schristos libpython2.4.so.1.0`PyObject_Call+0x1d 37*c29d5175Schristos libpython2.4.so.1.0`PyEval_CallObjectWithKeywords+0xb8 38*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xd3c 39*c29d5175Schristos [ /usr/lib/python2.4/encodings/__init__.py:28 (?) ] 40*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 41*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCode+0x22 42*c29d5175Schristos libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0 43*c29d5175Schristos libpython2.4.so.1.0`load_source_module+0xe6 44*c29d5175Schristos libpython2.4.so.1.0`load_module+0xac 45*c29d5175Schristos libpython2.4.so.1.0`load_package+0xef 46*c29d5175Schristos libpython2.4.so.1.0`load_module+0x6a 47*c29d5175Schristos libpython2.4.so.1.0`import_submodule+0xfb 48*c29d5175Schristos libpython2.4.so.1.0`load_next+0xa2 49*c29d5175Schristos libpython2.4.so.1.0`import_module_ex+0x48 50*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d 51*c29d5175Schristos libpython2.4.so.1.0`_PyCodecRegistry_Init+0xce 52*c29d5175Schristos libpython2.4.so.1.0`_PyCodec_Lookup+0x2a 53*c29d5175Schristos libpython2.4.so.1.0`PyCodec_Encoder+0xf 54*c29d5175Schristos libpython2.4.so.1.0`Py_InitializeEx+0x257 55*c29d5175Schristos libpython2.4.so.1.0`Py_Initialize+0xd 56*c29d5175Schristos libpython2.4.so.1.0`Py_Main+0x4db 57*c29d5175Schristos python`main+0x11 58*c29d5175Schristos python`_start+0x7a 59*c29d5175Schristos 60*c29d5175Schristos value ------------- Distribution ------------- count 61*c29d5175Schristos 0 | 0 62*c29d5175Schristos 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 63*c29d5175Schristos 2 | 0 64*c29d5175Schristos 65*c29d5175Schristos 66*c29d5175Schristos libc.so.1`malloc 67*c29d5175Schristos libpython2.4.so.1.0`_PyUnicode_New+0xb2 68*c29d5175Schristos libpython2.4.so.1.0`_PyUnicodeUCS2_Init+0x19 69*c29d5175Schristos libpython2.4.so.1.0`Py_InitializeEx+0x11c 70*c29d5175Schristos libpython2.4.so.1.0`Py_Initialize+0xd 71*c29d5175Schristos libpython2.4.so.1.0`Py_Main+0x4db 72*c29d5175Schristos python`main+0x11 73*c29d5175Schristos python`_start+0x7a 74*c29d5175Schristos 75*c29d5175Schristos value ------------- Distribution ------------- count 76*c29d5175Schristos 1 | 0 77*c29d5175Schristos 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 78*c29d5175Schristos 4 | 0 79*c29d5175Schristos 80*c29d5175Schristos 81*c29d5175Schristos libc.so.1`malloc 82*c29d5175Schristos libc.so.1`_real_gettext_u+0x81 83*c29d5175Schristos libc.so.1`dgettext+0x5e 84*c29d5175Schristos libc.so.1`strerror+0x40 85*c29d5175Schristos libpython2.4.so.1.0`PyErr_SetFromErrnoWithFilenameObject+0x2d 86*c29d5175Schristos libpython2.4.so.1.0`PyErr_SetFromErrnoWithFilename+0x27 87*c29d5175Schristos libpython2.4.so.1.0`posix_error_with_allocated_filename+0x17 88*c29d5175Schristos libpython2.4.so.1.0`posix_do_stat+0x21f 89*c29d5175Schristos libpython2.4.so.1.0`posix_stat+0x1f 90*c29d5175Schristos libpython2.4.so.1.0`PyCFunction_Call+0x15f 91*c29d5175Schristos libpython2.4.so.1.0`call_function+0x406 92*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 93*c29d5175Schristos [ /usr/lib/python2.4/posixpath.py:195 (isdir) ] 94*c29d5175Schristos libpython2.4.so.1.0`fast_function+0xa8 95*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 96*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 97*c29d5175Schristos [ /usr/lib/python2.4/site.py:202 (addsitepackages) ] 98*c29d5175Schristos libpython2.4.so.1.0`fast_function+0xa8 99*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 100*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 101*c29d5175Schristos [ /usr/lib/python2.4/site.py:382 (main) ] 102*c29d5175Schristos libpython2.4.so.1.0`fast_function+0xa8 103*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 104*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 105*c29d5175Schristos [ /usr/lib/python2.4/site.py:397 (?) ] 106*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 107*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCode+0x22 108*c29d5175Schristos libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0 109*c29d5175Schristos libpython2.4.so.1.0`load_source_module+0xe6 110*c29d5175Schristos libpython2.4.so.1.0`load_module+0xac 111*c29d5175Schristos libpython2.4.so.1.0`import_submodule+0xfb 112*c29d5175Schristos libpython2.4.so.1.0`load_next+0xa2 113*c29d5175Schristos libpython2.4.so.1.0`import_module_ex+0x48 114*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d 115*c29d5175Schristos libpython2.4.so.1.0`builtin___import__+0x4e 116*c29d5175Schristos libpython2.4.so.1.0`PyCFunction_Call+0x15f 117*c29d5175Schristos libpython2.4.so.1.0`PyObject_Call+0x1d 118*c29d5175Schristos libpython2.4.so.1.0`PyObject_CallFunction+0x90 119*c29d5175Schristos libpython2.4.so.1.0`PyImport_Import+0x163 120*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModule+0x1f 121*c29d5175Schristos libpython2.4.so.1.0`initsite+0x10 122*c29d5175Schristos libpython2.4.so.1.0`Py_InitializeEx+0x1ea 123*c29d5175Schristos libpython2.4.so.1.0`Py_Initialize+0xd 124*c29d5175Schristos libpython2.4.so.1.0`Py_Main+0x4db 125*c29d5175Schristos python`main+0x11 126*c29d5175Schristos python`_start+0x7a 127*c29d5175Schristos 128*c29d5175Schristos value ------------- Distribution ------------- count 129*c29d5175Schristos 1 | 0 130*c29d5175Schristos 2 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 131*c29d5175Schristos 4 | 0 132*c29d5175Schristos 133*c29d5175Schristos[... around 17000 lines truncated ...] 134*c29d5175Schristos 135*c29d5175Schristos 136*c29d5175Schristos libc.so.1`malloc 137*c29d5175Schristos libpython2.4.so.1.0`PyObject_Malloc+0x126 138*c29d5175Schristos libpython2.4.so.1.0`fixstate+0x26 139*c29d5175Schristos libpython2.4.so.1.0`fixdfa+0x2a 140*c29d5175Schristos libpython2.4.so.1.0`PyGrammar_AddAccelerators+0x1b 141*c29d5175Schristos libpython2.4.so.1.0`PyParser_New+0x18 142*c29d5175Schristos libpython2.4.so.1.0`parsetok+0x17 143*c29d5175Schristos libpython2.4.so.1.0`PyParser_ParseStringFlagsFilename+0x72 144*c29d5175Schristos libpython2.4.so.1.0`PyParser_ParseStringFlags+0x1c 145*c29d5175Schristos libpython2.4.so.1.0`PyParser_SimpleParseStringFlags+0x23 146*c29d5175Schristos libpython2.4.so.1.0`PyRun_StringFlags+0x2c 147*c29d5175Schristos libpython2.4.so.1.0`builtin_eval+0x273 148*c29d5175Schristos libpython2.4.so.1.0`PyCFunction_Call+0x15f 149*c29d5175Schristos libpython2.4.so.1.0`call_function+0x406 150*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 151*c29d5175Schristos [ /usr/lib/python2.4/os.py:503 (_exists) ] 152*c29d5175Schristos libpython2.4.so.1.0`fast_function+0xa8 153*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 154*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 155*c29d5175Schristos [ /usr/lib/python2.4/os.py:509 (?) ] 156*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 157*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCode+0x22 158*c29d5175Schristos libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0 159*c29d5175Schristos libpython2.4.so.1.0`load_source_module+0xe6 160*c29d5175Schristos libpython2.4.so.1.0`load_module+0xac 161*c29d5175Schristos libpython2.4.so.1.0`import_submodule+0xfb 162*c29d5175Schristos libpython2.4.so.1.0`load_next+0xa2 163*c29d5175Schristos libpython2.4.so.1.0`import_module_ex+0x48 164*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d 165*c29d5175Schristos libpython2.4.so.1.0`builtin___import__+0x4e 166*c29d5175Schristos libpython2.4.so.1.0`PyCFunction_Call+0x15f 167*c29d5175Schristos libpython2.4.so.1.0`PyObject_Call+0x1d 168*c29d5175Schristos libpython2.4.so.1.0`PyEval_CallObjectWithKeywords+0xb8 169*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xd3c 170*c29d5175Schristos [ /usr/lib/python2.4/site.py:58 (?) ] 171*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 172*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCode+0x22 173*c29d5175Schristos libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0 174*c29d5175Schristos libpython2.4.so.1.0`load_source_module+0xe6 175*c29d5175Schristos libpython2.4.so.1.0`load_module+0xac 176*c29d5175Schristos libpython2.4.so.1.0`import_submodule+0xfb 177*c29d5175Schristos libpython2.4.so.1.0`load_next+0xa2 178*c29d5175Schristos libpython2.4.so.1.0`import_module_ex+0x48 179*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d 180*c29d5175Schristos libpython2.4.so.1.0`builtin___import__+0x4e 181*c29d5175Schristos libpython2.4.so.1.0`PyCFunction_Call+0x15f 182*c29d5175Schristos libpython2.4.so.1.0`PyObject_Call+0x1d 183*c29d5175Schristos libpython2.4.so.1.0`PyObject_CallFunction+0x90 184*c29d5175Schristos libpython2.4.so.1.0`PyImport_Import+0x163 185*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModule+0x1f 186*c29d5175Schristos libpython2.4.so.1.0`initsite+0x10 187*c29d5175Schristos libpython2.4.so.1.0`Py_InitializeEx+0x1ea 188*c29d5175Schristos libpython2.4.so.1.0`Py_Initialize+0xd 189*c29d5175Schristos libpython2.4.so.1.0`Py_Main+0x4db 190*c29d5175Schristos python`main+0x11 191*c29d5175Schristos python`_start+0x7a 192*c29d5175Schristos 193*c29d5175Schristos value ------------- Distribution ------------- count 194*c29d5175Schristos 256 | 0 195*c29d5175Schristos 512 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 331 196*c29d5175Schristos 1024 | 0 197*c29d5175Schristos 198*c29d5175Schristos 199*c29d5175Schristos libc.so.1`malloc 200*c29d5175Schristos libpython2.4.so.1.0`new_arena+0x13 201*c29d5175Schristos libpython2.4.so.1.0`PyObject_Malloc+0x91 202*c29d5175Schristos libpython2.4.so.1.0`string_concat+0x109 203*c29d5175Schristos libpython2.4.so.1.0`PyString_Concat+0x3b 204*c29d5175Schristos libpython2.4.so.1.0`string_concatenate+0x150 205*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0x27cc 206*c29d5175Schristos [ /usr/lib/python2.4/posixpath.py:62 (join) ] 207*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 208*c29d5175Schristos libpython2.4.so.1.0`function_call+0x15e 209*c29d5175Schristos libpython2.4.so.1.0`PyObject_Call+0x1d 210*c29d5175Schristos libpython2.4.so.1.0`ext_do_call+0xfb 211*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xb4f 212*c29d5175Schristos [ /usr/lib/python2.4/site.py:66 (makepath) ] 213*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 214*c29d5175Schristos libpython2.4.so.1.0`fast_function+0x112 215*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 216*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 217*c29d5175Schristos [ /usr/lib/python2.4/site.py:138 (addpackage) ] 218*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 219*c29d5175Schristos libpython2.4.so.1.0`fast_function+0x112 220*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 221*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 222*c29d5175Schristos [ /usr/lib/python2.4/site.py:166 (addsitedir) ] 223*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 224*c29d5175Schristos libpython2.4.so.1.0`fast_function+0x112 225*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 226*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 227*c29d5175Schristos [ <string>:1 (?) ] 228*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 229*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCode+0x22 230*c29d5175Schristos libpython2.4.so.1.0`run_node+0x35 231*c29d5175Schristos libpython2.4.so.1.0`run_err_node+0x1f 232*c29d5175Schristos libpython2.4.so.1.0`PyRun_String+0x27 233*c29d5175Schristos libpython2.4.so.1.0`exec_statement+0x2b0 234*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0x15d6 235*c29d5175Schristos [ /usr/lib/python2.4/site.py:134 (addpackage) ] 236*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 237*c29d5175Schristos libpython2.4.so.1.0`fast_function+0x112 238*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 239*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 240*c29d5175Schristos [ /usr/lib/python2.4/site.py:166 (addsitedir) ] 241*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 242*c29d5175Schristos libpython2.4.so.1.0`fast_function+0x112 243*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 244*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 245*c29d5175Schristos [ /usr/lib/python2.4/site.py:203 (addsitepackages) ] 246*c29d5175Schristos libpython2.4.so.1.0`fast_function+0xa8 247*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 248*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 249*c29d5175Schristos [ /usr/lib/python2.4/site.py:382 (main) ] 250*c29d5175Schristos libpython2.4.so.1.0`fast_function+0xa8 251*c29d5175Schristos libpython2.4.so.1.0`call_function+0xda 252*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalFrame+0xbdf 253*c29d5175Schristos [ /usr/lib/python2.4/site.py:397 (?) ] 254*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCodeEx+0x732 255*c29d5175Schristos libpython2.4.so.1.0`PyEval_EvalCode+0x22 256*c29d5175Schristos libpython2.4.so.1.0`PyImport_ExecCodeModuleEx+0xc0 257*c29d5175Schristos libpython2.4.so.1.0`load_source_module+0xe6 258*c29d5175Schristos libpython2.4.so.1.0`load_module+0xac 259*c29d5175Schristos libpython2.4.so.1.0`import_submodule+0xfb 260*c29d5175Schristos libpython2.4.so.1.0`load_next+0xa2 261*c29d5175Schristos libpython2.4.so.1.0`import_module_ex+0x48 262*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModuleEx+0x1d 263*c29d5175Schristos libpython2.4.so.1.0`builtin___import__+0x4e 264*c29d5175Schristos libpython2.4.so.1.0`PyCFunction_Call+0x15f 265*c29d5175Schristos libpython2.4.so.1.0`PyObject_Call+0x1d 266*c29d5175Schristos libpython2.4.so.1.0`PyObject_CallFunction+0x90 267*c29d5175Schristos libpython2.4.so.1.0`PyImport_Import+0x163 268*c29d5175Schristos libpython2.4.so.1.0`PyImport_ImportModule+0x1f 269*c29d5175Schristos libpython2.4.so.1.0`initsite+0x10 270*c29d5175Schristos libpython2.4.so.1.0`Py_InitializeEx+0x1ea 271*c29d5175Schristos libpython2.4.so.1.0`Py_Initialize+0xd 272*c29d5175Schristos libpython2.4.so.1.0`Py_Main+0x4db 273*c29d5175Schristos 274*c29d5175Schristos value ------------- Distribution ------------- count 275*c29d5175Schristos 131072 | 0 276*c29d5175Schristos 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 277*c29d5175Schristos 524288 | 0 278*c29d5175Schristos 279*c29d5175Schristos 280*c29d5175Schristos libc.so.1`malloc 281*c29d5175Schristos libpython2.4.so.1.0`new_arena+0x13 282*c29d5175Schristos libpython2.4.so.1.0`PyObject_Malloc+0x91 283*c29d5175Schristos libpython2.4.so.1.0`_PyObject_GC_Malloc+0x13 284*c29d5175Schristos libpython2.4.so.1.0`_PyObject_GC_NewVar+0x24 285*c29d5175Schristos libpython2.4.so.1.0`PyTuple_New+0x78 286*c29d5175Schristos libpython2.4.so.1.0`PyType_Ready+0x98 287*c29d5175Schristos libpython2.4.so.1.0`PyType_Ready+0x60 288*c29d5175Schristos libpython2.4.so.1.0`_Py_ReadyTypes+0x10 289*c29d5175Schristos libpython2.4.so.1.0`Py_InitializeEx+0xed 290*c29d5175Schristos libpython2.4.so.1.0`Py_Initialize+0xd 291*c29d5175Schristos libpython2.4.so.1.0`Py_Main+0x4db 292*c29d5175Schristos python`main+0x11 293*c29d5175Schristos python`_start+0x7a 294*c29d5175Schristos 295*c29d5175Schristos value ------------- Distribution ------------- count 296*c29d5175Schristos 131072 | 0 297*c29d5175Schristos 262144 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1 298*c29d5175Schristos 524288 | 0 299*c29d5175Schristos 300*c29d5175Schristos 301*c29d5175SchristosThis output looks a little unusual at first glance, and can be confusing for 302*c29d5175Schristospeople unfamiliar with stack tracing and Python engine internals. 303*c29d5175Schristos 304*c29d5175SchristosStart by looking at the distribution plots below each stack trace - each plot 305*c29d5175Schristosshows how many bytes were requested as a histogram by byte size. This should 306*c29d5175Schristosindicated to you if python is malloc()ing much memory or not, and whether it 307*c29d5175Schristosis doing so in a few large malloc()s or many small ones. 308*c29d5175Schristos 309*c29d5175SchristosWith this information in mind you can inspect the stack traces - these explain 310*c29d5175Schristoswhy Python called malloc() in that instance, along with translations of Python 311*c29d5175Schristosfunctions buried in the stack trace. The stack traces can be hard to read at 312*c29d5175Schristosfirst (or even at second or at third) - since you are examining Python engine 313*c29d5175Schristosinternals. Try looking for lines in square brackets - those are Python language 314*c29d5175Schristosframes, and will show where (or if) the malloc() was caused by Python code. 315