相关疑难解决方法(0)

如何使用valgrind查找内存泄漏?

如何使用valgrind查找程序中的内存泄漏?

请有人帮助我并描述执行程序的步骤?

我正在使用Ubuntu 10.04,我有一个程序a.c,请帮帮我.

c valgrind

134
推荐指数
4
解决办法
23万
查看次数

ImportError:没有名为concurrent.futures.process的模块

我已经按照如何使用valgrind与python中给出的过程进行了操作用于检查我的python代码中的内存泄漏.

我在路径下有我的python源代码

/root/Test/ACD/atech
Run Code Online (Sandbox Code Playgroud)

我已经给出了上述路径PYTHONPATH.如果我使用默认的python二进制文件运行代码,一切正常/usr/bin/.我需要使用我手动构建的python二进制文件来运行代码

/home/abcd/workspace/python/bin/python
Run Code Online (Sandbox Code Playgroud)

然后我收到以下错误

from concurrent.futures.process import ProcessPoolExecutor
ImportError: No module named concurrent.futures.process
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题?

python path

54
推荐指数
1
解决办法
6万
查看次数

在valgrind下运行python会显示许多内存错误,这是正常的吗?

我试图在我的Python C扩展中调试内存崩溃,并尝试在valgrind下运行脚本.我发现valgrind输出中有太多的"噪音",即使我运行简单的命令:

valgrind python -c ""
Run Code Online (Sandbox Code Playgroud)

Valgrind输出完整的重复信息,如下所示:

==12317== Invalid read of size 4
==12317==    at 0x409CF59: PyObject_Free (in /usr/lib/libpython2.5.so.1.0)
==12317==    by 0x405C7C7: PyGrammar_RemoveAccelerators (in /usr/lib/libpython2.5.so.1.0)
==12317==    by 0x410A1EC: Py_Finalize (in /usr/lib/libpython2.5.so.1.0)
==12317==    by 0x4114FD1: Py_Main (in /usr/lib/libpython2.5.so.1.0)
==12317==    by 0x8048591: main (in /usr/bin/python2.5)
==12317==  Address 0x43CD010 is 7,016 bytes inside a block of size 8,208 free'd
==12317==    at 0x4022F6C: free (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==12317==    by 0x4107ACC: PyArena_Free (in /usr/lib/libpython2.5.so.1.0)
==12317==    by 0x41095D7: PyRun_StringFlags (in /usr/lib/libpython2.5.so.1.0)
==12317==    by 0x40DF262: (within /usr/lib/libpython2.5.so.1.0)
==12317== …
Run Code Online (Sandbox Code Playgroud)

python debugging valgrind memory-leaks python-c-extension

17
推荐指数
2
解决办法
6516
查看次数

`tiny_malloc_from_free_list` made my pointer `NULL`?

I am working on code that includes bllipparser Python module, among other things. Feeding it the same dataset, it will intermittently crash (maybe once in three to ten runs). Going through lldb, I found that the public field weights of RerankerModel (source), that is apparently only set once (in the constructor), randomly becomes NULL (I only have one RerankerModel for the duration of my run, so there should be exactly one weights, that persists unchanged throughout). …

python macos memory-management lldb bllip-parser

11
推荐指数
1
解决办法
268
查看次数

我如何将Valgrind与Ruby一起使用?

我已经按照valgrind-docs的建议编译了ruby(2.2.4).根据至少几个虽然模糊不清的资源,人们已经成功地使用了Valgrind和红宝石,但是更多的选择似乎存在于debugflags='-g' optflags='-O0' ./configure --with-valgrind--with-valgrind1.9.3

./doc/ChangeLog-1.9.3:62800:*configure.in:add --with-valgrind.

我所遇到的错误与类似的python问题中提到的错误相同,即使是基本的测试程序也会报告"参考丢失"/"可能丢失"的大量误报.

样本输出:

valgrind --tool=memcheck --leak-check=yes --max-stackframe=8382448 --track-origins=yes ruby test.rb

==15105== HEAP SUMMARY:
==15105==     in use at exit: 840,786 bytes in 8,050 blocks
==15105==   total heap usage: 10,496 allocs, 2,446 frees, 2,373,732 bytes allocated
==15105== 
==15105== 16 bytes in 1 blocks are possibly lost in loss record 87 of 5,245
==15105==    at 0x4C2ABD0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15105==    by 0x1511F4: objspace_xmalloc0 (gc.c:7780)
==15105== …
Run Code Online (Sandbox Code Playgroud)

ruby valgrind memory-leaks

9
推荐指数
1
解决办法
1175
查看次数

Python:Ctypes 如何检查内存管理

所以我使用 Python 作为前端 GUI,它与一些 C 文件交互以作为后端进行存储和内存管理。每当 GUI 的窗口关闭或退出时,我都会为分配的变量调用所有析构函数方法。

无论如何,在退出整个程序以确保没有任何内存泄漏之前,是否可以检查内存泄漏或可用性,例如 C Valgrind 检查?

示例退出:

from tkinter import *
root = Tk()  # New GUI
# some code here

def destructorMethods:
    myFunctions.destructorLinkedList()  # Destructor method of my allocated memory in my C file
    # Here is where I would want to run a Valgrind/Memory management check before closing
    root.destroy()  # close the program

root.protocol("WM_DELETE_WINDOW", destructorMethods)  # When the close window option is pressed call destructorMethods function

Run Code Online (Sandbox Code Playgroud)

c python ctypes valgrind memory-management

9
推荐指数
1
解决办法
377
查看次数