Android 应用程序未生成 hprof 文件

hprof file not generated by Android application

我正在 eclipse 中调试 Android 幻灯片播放应用程序。我正在尝试生成堆转储以查找内存泄漏的来源,但在我正在测试的文件夹"/data/data/app 文件夹/"android 设备中没有生成 hprof 文件。以下是我生成文件的代码。这有什么问题吗?提前致谢!

public class HeapDumpingUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
private static final String HPROF_DUMP_BASENAME = "leak-app-";
private final String dataDir;

public HeapDumpingUncaughtExceptionHandler(String dataDir) {
    this.dataDir = dataDir;
    Date d = new Date();
    CharSequence s  = DateFormat.format("yyyy-MM-dd_HH-mm-ss", d.getTime());

    String absPath = new File(dataDir, HPROF_DUMP_BASENAME +s+".hprof").getAbsolutePath();

                     try {
                    Log.d(this.getClass().toString(),"memory leak app handler: initial heap dump created "+ absPath);
                         Debug.dumpHprofData(absPath);

                     } catch (IOException e) {
                         e.printStackTrace();
                     }
}

@Override
public void uncaughtException(Thread thread, Throwable ex) {

    Date d = new Date();
    CharSequence s  = DateFormat.format("yyyy-MM-dd_HH-mm-ss", d.getTime());

    String absPath = new File(dataDir, HPROF_DUMP_BASENAME+s+".hprof").getAbsolutePath();

    Log.d(this.getClass().toString(),"memory leak app handler: exception caught : "+ex.getClass()+ " heap dump path "+absPath);
        try {
            Debug.dumpHprofData(absPath);
        } catch (IOException e) {
            e.printStackTrace();
        }

    ex.printStackTrace();
}
}

终于发现我dun reli需要这个代码来生成hprof因为DDMS已经有这个功能了。不好意思打扰大家,谢谢。