如何使用DDMS在C ++ code内存泄漏 [英] how to use ddms for memory leaks in c++ code

查看:101
本文介绍了如何使用DDMS在C ++ code内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C + + code采用Android工具DDMS内存泄漏 我想,通过采取快照与NativeHeap启用的,但我不理解 什么快照都这么说,和符号都没有解决,没有文件名和行号显示。

how to use android tool DDMS for memory leaks in c++ code i tried, by taking snapshots with NativeHeap enabled, but i am not understanding what snapshots are saying, and symbols are not resolving , no file names and line numbers are shown.

推荐答案

在DDMS机堆跟踪是不支持的隐形功能。得到它的工作可以是一个有点棘手。这里有一个在邮件列表可以更早的讨论是有用的。

Native heap tracking in DDMS is an unsupported "stealth" feature. Getting it to work can be a bit tricky. There's an older discussion on a mailing list that may be useful.

如果您收到的数据,并具有用户界面,你已经完成了一半。 :-) DDMS会在特定位置的符号,你应该能够覆盖与 ANDROID_SYMBOLS 环境变量,并将其转换地址与 addr2line线(它也必须是能够找到)。

If you're receiving data and have the UI up, you're halfway there. :-) DDMS looks for symbols in a specific location which you should be able to override with the ANDROID_SYMBOLS environment variable, and converts addresses to lines with addr2line (which it must also be able to find).

找大泄漏的最简单方法是配置DDMS由库分配排序。让我们一会儿应用程序运行,看看哪个库似乎是增长速度最快。看看归因于该库中的分配,看看是否有很多是从同一个地方来了。看堆栈跟踪,看看它是否是有道理的有很多长寿的拨款从那里。不是很严谨,但它往往是卓有成效的。

The simplest way to look for big leaks is to configure DDMS to sort the allocations by library. Let the app run for a while and see which library seems to be growing the fastest. Look at the allocations attributed to that library and see if there's a lot that are coming from the same place. Look at the stack trace and see if it makes sense to have many long-lived allocations from there. Not very rigorous, but it often does the trick.

有关堆进行更彻底的检查,你可以Valgrind的在设备上运行,但是这不是任何容易设置的第一次。

For a more thorough examination of the heap, you can run valgrind on the device, but that's not any easier to set up the first time.

这篇关于如何使用DDMS在C ++ code内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆