在Valgrind下的Sun VM中运行JNI应用程序 [英] Running a JNI application in the Sun VM under Valgrind

查看:199
本文介绍了在Valgrind下的Sun VM中运行JNI应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在valgrind下运行时,太阳JVM会发出很多额外的噪音,这使得在应用程序中跟踪内存问题非常具有挑战性。



我想找到抑制文件或VM运行时模式,它将消除虚假的内存错误,以便在这种情况下将小麦与谷壳分开。有什么建议吗?

解决方案

我无法回答你发布的问题,但你能详细说明你遇到了什么问题吗? / p>

换句话说,你能告诉我们它是不是......




  • 在JNI层而不是JVM对象范围问题?

  • 使用free'd内存?

  • 缓冲区覆盖/覆盖?

  • 其他内存损坏?



我最近不得不调试有问题的Java / C(之后)它运行30分钟以上,结果是在它被释放后使用内存。我尝试使用dmalloc,我的自定义内存泄漏库,Valgrind并且没有按我需要的方式工作。



最后我在free,malloc,calloc周围创建了一组简单的包装器,realloc只是简单地将内存地址和大小打印到文件中。在它中止之后(在GDB内)我可以及时回溯并找出内存何时被释放以及哪些引用没有被删除。



如果你的问题是在C / C ++中,你可以在调试器中捕获错误,这可能对你有用。是的,这很乏味,但也许并不比筛选出数百万的Valgrind输出更糟糕。



希望有帮助&祝你好运。


The sun JVM spits out a LOT of extra noise when run under valgrind, which makes tracking memory problems in the application very challenging.

I'd like to find either a suppression file, or a VM runtime mode, that will strip out spurious memory errors in order to separate the wheat from the chaff in this situation. Any suggestions?

解决方案

I can't answer your posted question, but can you elaborate on what problem you're having?

In other words, can you tell us if it is...

  • In the JNI layer and not a JVM object scope issue?
  • A use of free'd memory?
  • A buffer underwrite/overwrite?
  • Other memory corruption?

I recently had to debug a Java/C that had issues (after 30+ minutes into its run), which it turns out was using memory after it had been free'd. I tried using dmalloc, a custom memory leak library of mine, Valgrind and none worked as I needed.

Eventually I created a simple set of wrappers around free, malloc, calloc, realloc that simply printed memory addresses and sizes to a file. After it aborted (within GDB) I could backtrack in time and figure out when the memory was free'd and where the references were that did not get removed.

IF your issue is in C/C++ and you can trap the error in a debugger this might work for you. Yes, it's tedious, but maybe no worse than sifting through megabytes of Valgrind output.

Hope that helps & good luck.

这篇关于在Valgrind下的Sun VM中运行JNI应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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