我有一个我写的程序,它的内存占用会随着时间的推移而增长。它最终会消耗所有可用的系统内存,然后使系统崩溃。
我正在尝试确定似乎是内存泄漏的来源。我已经在代码上运行了Valgrind。它没有明确或间接地报告内存丢失。它确实列出了可能丢失的内存,但没有太多的清晰度。我可以使用一些关于如何追踪这个问题的建议。
==13049== HEAP SUMMARY:
==13049== in use at exit: 2,240,095 bytes in 3,720 blocks
==13049== total heap usage: 50,296 allocs, 46,576 frees, 768
Val差伦产生以下消息块:
1,065,024 bytes in 66,564 blocks are definitely lost in loss record 21 of 27
at 0x4C2B800: operator new[](unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x40CA21: compute(Parameters&, Array<double>&) [clone .constprop.71] (array.hpp:135)
我有一个控制台程序,它使用一些Qt类。下面的代码是它的片段
std::cout << "before the problem (PVM constructor)" << std::endl;
image = new QImage(filename);
std::cout << "after the problem (PVM constructor)" << std::endl;
对valgrind运行它会抛出一些错误:
before the problem (PVM constructor)
==8344== Co
我正在编写一个程序来更好地理解ncurses,当我通过valgrind推动它时,它会输出许多与ncurses命令相关的泄漏信息。但是,我只使用stdscr,并在main()的末尾调用endwin()。我通过使用menu.h设置了用户选项,最后使用了free_item和free_menu:
menuChoice(WINDOW* scr, std::vector<std::string> *choices,
std::string desc)
{
//create the menu and the item pointer vector
MENU* my_men
我有一个java应用程序,它似乎被卡住了。我尝试了杀死-3,但是输出是空的(它被重定向到文件,但是没有)。
我怎样才能看到它在做什么?
编辑:
我试过了,但是它崩溃了:
Linux # /usr/pkgs/java/1.6.0.25/bin/jstack -F -l 12666
Attaching to process ID 12666, please wait...
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0xaf121777, pid=5423, tid=
I am using valgrind for the first time in linux
当我运行我的可执行文件时,我得到以下消息。
==31440==
==31440== FILE DESCRIPTORS: 3 open at exit.
==31440== Open file descriptor 2: /dev/pts/9
==31440== <inherited from parent>
==31440==
==31440== Open file descriptor 1: /dev/pt
为什么这会在Perl中泄漏?
$ perl -MDevel::LeakTrace::Fast -e 'our @a=(1);our @b=(1)'
leaked SV(0x0x84e053c) from -e line 1
$ perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi
[...]
$ uname -a
Linux ant1 2.4.21-20.ELsmp #1 SMP Wed Aug 18 20:46:40 EDT 2004 i686 i686 i386 GNU/Linux
谢谢!