我开始在iPhone 3G上使用Instruments-Leaks.当我尝试使用iPhone上的Instruments运行应用程序时,我获得了
Target failed to run: Remote exception encountered: 'Failed to get task for pid 280'
Run Code Online (Sandbox Code Playgroud)
想法?
我用仪器运行应用程序的唯一一次运行速度非常慢,我无法测试它.在搜索泄漏的设备上运行应用程序的步骤是什么?
我尝试用命令安装Valgrind brew install Valgrind
并且我收到一条消息"valgrind:由于上游不兼容,这个公式要么不能在比Sierra更新的macOS版本上按预期编译或运行.错误:不满意的要求使这个版本失败."
我尝试使用该命令安装brew intall --HEAD Valgrind
,在成功安装依赖项autoconf,automake和libtool后,当它尝试安装valgrind时,我收到配置错误:
"Valgrind适用于Darwin 10.x,11.x,12.x, 13.x,14.x,15.x,16.x和17.x(Mac OS X 10.6/7/8/9/10/11和macOS 10.12/13)"
我的操作系统是macOs Mojave(10.14),那么这是否意味着我无法安装一个功能正常的Valgrind和Homebrew?
在Python 2中有一些工具,但一切似乎都是旧的和过时的.
我发现了PySizer和Heapy但是一切似乎都是面向Python2的,需要付出很多努力来移植.
objgraph很有趣,但仍然不是一个完全工作的分析器
使用哪种工具?
python profiling memory-profiling memory-leak-detector python-3.x
我尝试使用命令“brew install valgrind”安装 Valgrind,我收到一条消息:
“valgrind:由于上游不兼容,此公式无法在比 Sierra 更新的 macOS 版本上按预期编译或运行。错误:未满足的要求使此构建失败。”
我还尝试在代码的头部部分“brew edit valgrind”并用“git://sourceware.org/git/valgrind.git”替换“sourceware.org/git/valgrind.git”,然后在Iterm上写“ brew install --HEAD valgrind
“但它给了我:
Last 15 lines from /Users/m/Library/Logs/Homebrew/valgrind/02.configure:
checking for gcc-ar... no
checking for perl... /usr/bin/perl
checking for gdb... /no/gdb/was/found/at/configure/time
checking dependency style of clang... none
checking for diff -u... yes
checking for clang option to accept ISO C99... none needed
checking for a supported version of gcc... ok (clang-11.0.0)
checking build system type... x86_64-pc-darwin
checking host system type... x86_64-pc-darwin
checking for a supported CPU... ok …
Run Code Online (Sandbox Code Playgroud) 如果我们想检查C++程序中的内存泄漏,我们可以重载new
和delete
运算符来跟踪分配的内存.如果我们想检查C程序中的泄漏怎么办?由于C中没有运算符重载,我们是否可以覆盖malloc
函数指针来拦截调用malloc
和跟踪内存分配?没有使用任何外部工具有没有更简单的方法?请提供一些代码,因为我不熟悉覆盖方法指针.
注意:我想在没有任何外部实用程序的情况下执行此操作.
我想检查一下我服务中的内存泄漏问题.我试过以下一组perfmon计数器.
我在这里提到了上面的集合
还提到以下集:
我在这里提到了上面的集合
是否有任何参数/标准或任何其他最佳方法来识别内存泄漏的perfmon计数器?
任何人都可以建议我使用一组计数器来检查内存泄漏吗?或以上设置涵盖内存泄漏?
performance memory-leaks perfmon performancecounter memory-leak-detector
我正在尝试使用Selenium Web Driver来自动化我的浏览器集成测试.我看到Chrome Dev Tools附带了一个控制台API,用于从JavaScript内部调用某些开发工具功能.
理想情况下,从我的Java/JUnit集成测试中,我可以启动Chrome Dev Tool内存分析器(可能还有其他一些工具),运行我的WebDriver测试(实例化Chrome浏览器实例,操作DOM元素等),然后停止探查器,然后检查探查器的结果,看看是否有任何内存泄漏.
这个概念是否可行,还是我出去吃午饭?为什么/为什么不呢?
似乎API已经有了console.profile()
启动分析会话,并且a console.profileEnd()
.所以理论上我可以让WebDriver调用这两个方法并在它们之间运行测试.
我认为缺失的链接然后以编程方式与分析会话的结果进行交互...
integration-testing profiling memory-leak-detector google-chrome-devtools selenium-webdriver
有什么建议?这篇SO帖子讨论了Visual Leak Detector,但我正在寻找其他工具.另外,请不要推荐这个.
c++ memory-leaks visual-c++ memory-leak-detector visual-leak-detector
static char THIS_FILE[] = __FILE__;
?MFC,Microsoft的Windows原生类库,有一个DEBUG_NEW
跟踪内存分配的宏和它们发生的位置(在用户代码中).
为此,VS向导将以下代码块放入每个cpp文件中:( 不在头文件中)
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
Run Code Online (Sandbox Code Playgroud)
并且调试新宏定义为(in afx.h
):
#define DEBUG_NEW new(THIS_FILE, __LINE__)
Run Code Online (Sandbox Code Playgroud)
整个机器将产生有意义的泄漏检测输出,如:
Detected memory leaks!
Dumping objects ->
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\strcore.cpp(141) : {615} normal block at 0x04081CE0, 56 bytes long.
Data: <¬9Í] > AC 39 CD 5D 13 00 00 00 13 00 00 00 01 00 00 00
c:\my\dev\path\myfile.cpp(237) : {614} normal block at 0x04087FC0, 4 bytes long. …
Run Code Online (Sandbox Code Playgroud) mfc memory-leaks visual-c++ visual-studio-debugging memory-leak-detector
我尝试使用带有Visual Studio 2017的Visual Leak Detector和平台工具集"Visual Studio 2017"我已经设置了include目录和库目录.正在生成调试信息.加载了exe的符号.
(如果我将平台工具集更改为"Visual Studio 2013",它可以工作)
使用Toolset"Visual Studio 2017"VLD检测泄漏但不解决行号:
Visual Leak Detector read settings from: C:\Program Files (x86)\Visual Leak Detector\vld.ini
Visual Leak Detector Version 2.5.1 installed.
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 1 at 0x005ECDB8: 400 bytes ----------
Leak Hash: 0x36672640, Count: 1, Total 400 bytes
Call Stack (TID 6284):
ucrtbased.dll!malloc()
ConsoleApplication6.exe!0x00361FAD()
ConsoleApplication6.exe!0x003618BC()
ConsoleApplication6.exe!0x00361828()
ConsoleApplication6.exe!0x00361883()
ConsoleApplication6.exe!0x00361F7E()
ConsoleApplication6.exe!0x00361DE0()
ConsoleApplication6.exe!0x00361C7D()
ConsoleApplication6.exe!0x00361F98()
kernel32.dll!BaseThreadInitThunk() + 0x12 bytes
ntdll.dll!RtlInitializeExceptionChain() + 0x63 bytes
ntdll.dll!RtlInitializeExceptionChain() + 0x36 bytes
Run Code Online (Sandbox Code Playgroud)
也许有人知道一种启用行号解析的方法.
谢谢
memory-leak-detector visual-leak-detector visual-studio-2017
memory-leaks ×4
homebrew ×2
macos ×2
profiling ×2
valgrind ×2
visual-c++ ×2
c ×1
c++ ×1
instruments ×1
ios ×1
mfc ×1
perfmon ×1
performance ×1
python ×1
python-3.x ×1