我使用Cython做了一个相当复杂的python扩展。哪个工作正常,直到我得到一些奇怪的记忆行为,形式:
*** glibc detected *** /usr/bin/python2.7: double free or corruption (out): 0x0000000002177a30 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x7f1bf634bd76]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x6c)[0x7f1bf6350aac]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(+0x4dd1f)[0x7f1bf5a45d1f]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(+0x4e01b)[0x7f1bf5a4601b]
/usr/bin/python2.7(PyEval_EvalFrameEx+0x29b)[0x4eaa3b]
/usr/bin/python2.7(PyEval_EvalFrameEx+0xa82)[0x4eb222]
/usr/bin/python2.7(PyEval_EvalCodeEx+0x1a0)[0x4f1db0]
/usr/bin/python2.7[0x4f2e00]
/usr/bin/python2.7(PyObject_Call+0x36)[0x44a176]
/usr/bin/python2.7[0x47cc7a]
/usr/bin/python2.7(PyObject_Call+0x36)[0x44a176]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(cy_call_func_void+0xca)[0x7f1bf5a2196a]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(_ZN4elps17ALabSimulatorTime9FireEventEv+0x22)[0x7f1bf5a580c2]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/lib/libelp.so(_ZN4elps16LabSimulatorTime14StepSimulationEv+0x51)[0x7f1bf57ca351]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(_ZN4elps17ALabSimulatorTime14StepSimulationEv+0x40)[0x7f1bf5a583d0]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/lib/libelp.so(_ZN4elps16LabSimulatorTime13RunSimulationEv+0x42)[0x7f1bf57ca2c2]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(_ZN4elps17ALabSimulatorTime13RunSimulationEv+0x40)[0x7f1bf5a58330]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/lib/libelp.so(_ZN4elps16LabSimulatorBase3RunEv+0x24)[0x7f1bf57c79a4]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(+0x20e5d)[0x7f1bf5a18e5d]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(+0x1fec0)[0x7f1bf5a17ec0]
...
错误也可以采用以下形式:
*** glibc detected *** python: corrupted double-linked list: 0x0000000007dc67b0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x7f22b8789d76]
/lib/x86_64-linux-gnu/libc.so.6(+0x771ed)[0x7f22b878a1ed]
/lib/x86_64-linux-gnu/libc.so.6(+0x794d4)[0x7f22b878c4d4]
/lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x70)[0x7f22b878eb90]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znwm+0x1d)[0x7f22b7bf607d]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(_ZNSt6vectorIdSaIdEE13_M_insert_auxEN9__gnu_cxx17__normal_iteratorIPdS1_EERKd+0xee)[0x7f22b8159d7e]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(+0x4dd62)[0x7f22b814cd62]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(+0x4dffb)[0x7f22b814cffb]
python(PyEval_EvalFrameEx+0x29b)[0x4eaa3b]
python(PyEval_EvalFrameEx+0xa82)[0x4eb222]
python(PyEval_EvalCodeEx+0x1a0)[0x4f1db0]
python[0x4f2e00]
python(PyObject_Call+0x36)[0x44a176]
python[0x47cc7a]
python(PyObject_Call+0x36)[0x44a176]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(cy_call_func_void+0xca)[0x7f22b812894a]
/home/golgauth/Documents/02_DEV/EVOLAB/ECLIPSE-WS_ELP/evolab-cython/setup/cyelp.so(_ZN4elps17ALabSimulatorTime9FireEventEv+0x22)[0x7f22b815f092]
../../lib/libelp.so(_ZN4elps16LabSimulatorTime14StepSimulationEv+0x51)[0x7f22b7ed1351]
很抱歉我无法提交一些示例代码,因为错误可能是由任何原因引起的。
由于我无法找到问题的根源,我开始使用Valgrind。令人惊讶(对我而言),我的程序在使用valgrind启动时拒绝崩溃。
这是我的启动脚本:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../../lib
export PYTHONPATH=$PYTHONPATH:../../setup
# Run simulation
valgrind --log-file=valgrind.report --show-reachable=no --leak-check=full --tool=memcheck --suppressions=valgrind-python.supp python ./BdmLsim4.py -i model.xml
#python BdmLsim4.py -i model.xml
所以我的问题是:运行python脚本的方式之间可能存在哪些区别?除了脚本似乎运行速度较慢外,Valgrind是否在特定环境/模式下切换?
我在gcc版本4.7.2(Debian 4.7.2-4)和Cython版本0.18下。
如果Valgrind不能为我做任何事情,是否有另一个程序可以帮助进行内存故障跟踪......
Nota Bene:我很擅长使用Valgrind,所以在理解Valgrind的报告时我可能会遗漏一些东西:
...
==5679==
==5679== Invalid write of size 8
==5679== at 0x812DB01: elps::ALabNode::SetPyObj(_object*) (ALabNetBinding.cpp:27)
==5679== by 0x8113B2C: __pyx_f_5cyelp_12PyLabNetwork_Populate(__pyx_obj_5cyelp_PyLabNetwork*, int, int) (cyelp.cpp:10112)
==5679== by 0x81070B3: __pyx_pw_5cyelp_12PyLabNetwork_5Populate(_object*, _object*) (cyelp.cpp:10281)
==5679== by 0x4EB165: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4D980C: PyRun_FileExFlags (in /usr/bin/python2.7)
==5679== by 0x4D9A95: PyRun_SimpleFileExFlags (in /usr/bin/python2.7)
==5679== by 0x4DA39D: Py_Main (in /usr/bin/python2.7)
==5679== by 0x5F4BEAC: (below main) (libc-start.c:228)
==5679== Address 0x65e3170 is 0 bytes after a block of size 112 alloc'd
==5679== at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
==5679== by 0x839BD52: elps::LabNetwork::add_new_node() (LabNetwork.cpp:144)
==5679== by 0x839BDCA: elps::LabNetwork::populate(int) (LabNetwork.cpp:138)
==5679== by 0x8113AB4: __pyx_f_5cyelp_12PyLabNetwork_Populate(__pyx_obj_5cyelp_PyLabNetwork*, int, int) (cyelp.cpp:10216)
==5679== by 0x81070B3: __pyx_pw_5cyelp_12PyLabNetwork_5Populate(_object*, _object*) (cyelp.cpp:10281)
==5679== by 0x4EB165: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4D980C: PyRun_FileExFlags (in /usr/bin/python2.7)
==5679== by 0x4D9A95: PyRun_SimpleFileExFlags (in /usr/bin/python2.7)
==5679== by 0x4DA39D: Py_Main (in /usr/bin/python2.7)
==5679== by 0x5F4BEAC: (below main) (libc-start.c:228)
==5679==
==5679== Invalid read of size 8
==5679== at 0x812DB11: elps::ALabNode::SetPyObj(_object*) (ALabNetBinding.cpp:31)
==5679== by 0x8113B2C: __pyx_f_5cyelp_12PyLabNetwork_Populate(__pyx_obj_5cyelp_PyLabNetwork*, int, int) (cyelp.cpp:10112)
==5679== by 0x81070B3: __pyx_pw_5cyelp_12PyLabNetwork_5Populate(_object*, _object*) (cyelp.cpp:10281)
==5679== by 0x4EB165: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4D980C: PyRun_FileExFlags (in /usr/bin/python2.7)
==5679== by 0x4D9A95: PyRun_SimpleFileExFlags (in /usr/bin/python2.7)
==5679== by 0x4DA39D: Py_Main (in /usr/bin/python2.7)
==5679== by 0x5F4BEAC: (below main) (libc-start.c:228)
==5679== Address 0x65e3170 is 0 bytes after a block of size 112 alloc'd
==5679== at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
==5679== by 0x839BD52: elps::LabNetwork::add_new_node() (LabNetwork.cpp:144)
==5679== by 0x839BDCA: elps::LabNetwork::populate(int) (LabNetwork.cpp:138)
==5679== by 0x8113AB4: __pyx_f_5cyelp_12PyLabNetwork_Populate(__pyx_obj_5cyelp_PyLabNetwork*, int, int) (cyelp.cpp:10216)
==5679== by 0x81070B3: __pyx_pw_5cyelp_12PyLabNetwork_5Populate(_object*, _object*) (cyelp.cpp:10281)
==5679== by 0x4EB165: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4D980C: PyRun_FileExFlags (in /usr/bin/python2.7)
==5679== by 0x4D9A95: PyRun_SimpleFileExFlags (in /usr/bin/python2.7)
==5679== by 0x4DA39D: Py_Main (in /usr/bin/python2.7)
==5679== by 0x5F4BEAC: (below main) (libc-start.c:228)
==5679==
==5679== Invalid write of size 8
==5679== at 0x8134CE1: elps::ALabSiteEvent::SetPyObj(_object*) (ALabSite.cpp:135)
==5679== by 0x8107DC3: __pyx_f_5cyelp_15PyLabNetBinding_setup_pyobjects(__pyx_obj_5cyelp_PyLabNetBinding*) (cyelp.cpp:13361)
==5679== by 0x811C55F: __pyx_f_5cyelp_15PyLabNetBinding_Populate1(__pyx_obj_5cyelp_PyLabNetBinding*, _object*, _object*, int, int) (cyelp.cpp:13677)
==5679== by 0x81018E0: __pyx_pw_5cyelp_15PyLabNetBinding_13Populate1(_object*, _object*, _object*) (cyelp.cpp:13778)
==5679== by 0x4EAA3A: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4F2DFF: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x47CC79: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x80F6969: cy_call_func_void (cyelp.cpp:2937)
==5679== Address 0x6e66128 is 0 bytes after a block of size 152 alloc'd
==5679== at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
==5679== by 0x83924E2: elps::LabSiteEvent::New(elps::LabNode*) (LabSiteEvent.cpp:108)
==5679== by 0x83888FF: elps::LabNetBinding::Populate(std::vector<double, std::allocator<double> >&, std::vector<elps::LabSiteBase*, std::allocator<elps::LabSiteBase*> >&, bool) (LabNetBinding.cpp:154)
==5679== by 0x811C550: __pyx_f_5cyelp_15PyLabNetBinding_Populate1(__pyx_obj_5cyelp_PyLabNetBinding*, _object*, _object*, int, int) (cyelp.cpp:13668)
==5679== by 0x81018E0: __pyx_pw_5cyelp_15PyLabNetBinding_13Populate1(_object*, _object*, _object*) (cyelp.cpp:13778)
==5679== by 0x4EAA3A: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4F2DFF: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x47CC79: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679==
==5679== Invalid read of size 8
==5679== at 0x8134CF2: elps::ALabSiteEvent::SetPyObj(_object*) (ALabSite.cpp:137)
==5679== by 0x8107DC3: __pyx_f_5cyelp_15PyLabNetBinding_setup_pyobjects(__pyx_obj_5cyelp_PyLabNetBinding*) (cyelp.cpp:13361)
==5679== by 0x811C55F: __pyx_f_5cyelp_15PyLabNetBinding_Populate1(__pyx_obj_5cyelp_PyLabNetBinding*, _object*, _object*, int, int) (cyelp.cpp:13677)
==5679== by 0x81018E0: __pyx_pw_5cyelp_15PyLabNetBinding_13Populate1(_object*, _object*, _object*) (cyelp.cpp:13778)
==5679== by 0x4EAA3A: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4F2DFF: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x47CC79: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x80F6969: cy_call_func_void (cyelp.cpp:2937)
==5679== Address 0x6e66128 is 0 bytes after a block of size 152 alloc'd
==5679== at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
==5679== by 0x83924E2: elps::LabSiteEvent::New(elps::LabNode*) (LabSiteEvent.cpp:108)
==5679== by 0x83888FF: elps::LabNetBinding::Populate(std::vector<double, std::allocator<double> >&, std::vector<elps::LabSiteBase*, std::allocator<elps::LabSiteBase*> >&, bool) (LabNetBinding.cpp:154)
==5679== by 0x811C550: __pyx_f_5cyelp_15PyLabNetBinding_Populate1(__pyx_obj_5cyelp_PyLabNetBinding*, _object*, _object*, int, int) (cyelp.cpp:13668)
==5679== by 0x81018E0: __pyx_pw_5cyelp_15PyLabNetBinding_13Populate1(_object*, _object*, _object*) (cyelp.cpp:13778)
==5679== by 0x4EAA3A: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4F2DFF: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x47CC79: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679==
==5679== Invalid read of size 8
==5679== at 0x8134D04: elps::ALabSiteEvent::SetPyObj(_object*) (ALabSite.cpp:139)
==5679== by 0x8107DC3: __pyx_f_5cyelp_15PyLabNetBinding_setup_pyobjects(__pyx_obj_5cyelp_PyLabNetBinding*) (cyelp.cpp:13361)
==5679== by 0x811C55F: __pyx_f_5cyelp_15PyLabNetBinding_Populate1(__pyx_obj_5cyelp_PyLabNetBinding*, _object*, _object*, int, int) (cyelp.cpp:13677)
==5679== by 0x81018E0: __pyx_pw_5cyelp_15PyLabNetBinding_13Populate1(_object*, _object*, _object*) (cyelp.cpp:13778)
==5679== by 0x4EAA3A: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4F2DFF: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x47CC79: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x80F6969: cy_call_func_void (cyelp.cpp:2937)
==5679== Address 0x6e66128 is 0 bytes after a block of size 152 alloc'd
==5679== at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
==5679== by 0x83924E2: elps::LabSiteEvent::New(elps::LabNode*) (LabSiteEvent.cpp:108)
==5679== by 0x83888FF: elps::LabNetBinding::Populate(std::vector<double, std::allocator<double> >&, std::vector<elps::LabSiteBase*, std::allocator<elps::LabSiteBase*> >&, bool) (LabNetBinding.cpp:154)
==5679== by 0x811C550: __pyx_f_5cyelp_15PyLabNetBinding_Populate1(__pyx_obj_5cyelp_PyLabNetBinding*, _object*, _object*, int, int) (cyelp.cpp:13668)
==5679== by 0x81018E0: __pyx_pw_5cyelp_15PyLabNetBinding_13Populate1(_object*, _object*, _object*) (cyelp.cpp:13778)
==5679== by 0x4EAA3A: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4F2DFF: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x47CC79: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679==
==5679== Invalid read of size 8
==5679== at 0x812DAF0: elps::ALabNode::GetPyObj() (ALabNetBinding.cpp:24)
==5679== by 0x811985B: __pyx_f_5cyelp_9PyLabNode_GetNeighborAt(__pyx_obj_5cyelp_PyLabNode*, int, int) (cyelp.cpp:9483)
==5679== by 0x8107413: __pyx_pw_5cyelp_9PyLabNode_17GetNeighborAt(_object*, _object*) (cyelp.cpp:9540)
==5679== by 0x4EB165: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4F2DFF: ??? (in /usr/bin/python2.7)
==5679== by 0x44A175: PyObject_Call (in /usr/bin/python2.7)
==5679== by 0x80F3A68: __pyx_f_5cyelp_callback(void*, void*) (cyelp.cpp:16922)
==5679== by 0x80EF77A: __pyx_f_5cyelp_14PyLabSiteEvent_RealizeEvent(__pyx_obj_5cyelp_PyLabSiteEvent*, double, double, int) (cyelp.cpp:21478)
==5679== by 0x80FBA43: __pyx_pw_5cyelp_14PyLabSiteEvent_21RealizeEvent(_object*, _object*, _object*) (cyelp.cpp:21568)
==5679== by 0x4EAA3A: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== Address 0x7c81b50 is 0 bytes after a block of size 112 alloc'd
==5679== at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
==5679== by 0x839BD52: elps::LabNetwork::add_new_node() (LabNetwork.cpp:144)
==5679== by 0x839BDCA: elps::LabNetwork::populate(int) (LabNetwork.cpp:138)
==5679== by 0x8113AB4: __pyx_f_5cyelp_12PyLabNetwork_Populate(__pyx_obj_5cyelp_PyLabNetwork*, int, int) (cyelp.cpp:10216)
==5679== by 0x81070B3: __pyx_pw_5cyelp_12PyLabNetwork_5Populate(_object*, _object*) (cyelp.cpp:10281)
==5679== by 0x4EB165: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4EB221: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==5679== by 0x4F1DAF: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==5679== by 0x4D980C: PyRun_FileExFlags (in /usr/bin/python2.7)
==5679== by 0x4D9A95: PyRun_SimpleFileExFlags (in /usr/bin/python2.7)
==5679== by 0x4DA39D: Py_Main (in /usr/bin/python2.7)
==5679== by 0x5F4BEAC: (below main) (libc-start.c:228)
==5679==
==5679== Invalid read of size 4
==5679== at 0x545FFF: PyObject_Free (in /usr/bin/python2.7)
==5679== by 0x429D04: ??? (in /usr/bin/python2.7)
==5679== by 0x57B728: PyDict_SetItem (in /usr/bin/python2.7)
==5679== by 0x573998: _PyModule_Clear (in /usr/bin/python2.7)
==5679== by 0x535D36: PyImport_Cleanup (in /usr/bin/python2.7)
==5679== by 0x568AEB: Py_Finalize (in /usr/bin/python2.7)
==5679== by 0x4DA1E4: Py_Main (in /usr/bin/python2.7)
==5679== by 0x5F4BEAC: (below main) (libc-start.c:228)
==5679== Address 0x71f3020 is not stack'd, malloc'd or (recently) free'd
==5679==
...
对不起那种模糊的问题,谢谢你的帮助。
答案 0 :(得分:2)
Valgrind通过切换分配器并存储分配/访问信息来工作,因此分配将与程序正常运行时的模式不同。但是,没有必要让程序崩溃;只修复valgrind报告的错误:
==5679== Invalid write of size 8
==5679== at 0x812DB01: elps::ALabNode::SetPyObj(_object*) (ALabNetBinding.cpp:27)
...
==5679== Address 0x65e3170 is 0 bytes after a block of size 112 alloc'd
==5679== at 0x4C286E7: operator new(unsigned long) (vg_replace_malloc.c:287)
这表明elps::ALabNode::SetPyObj(_object*)
正在写一个对象的末尾,这通常会破坏该对象后面放置的内存。 (例如,malloc
内部结构。)修复此问题并报告所有其他问题,它可能会解决崩溃问题。