问题描述
很一般:
有没有一种简单的方法来判断何时访问冲突发生时code线最后释放的内存块?
Very general:Is there an easy way to tell which line of code last freed a block of memory when an access violation occurs?
减一般:
我剖析的理解是,他们覆盖的分配和释放的过程。如果这是真的,他们可能会发生存储code的,去年释放的内存部分,这样,当后来因为崩溃的访问冲突的,你知道是什么释放,那么它最后行了?
Less general:My understanding of profilers is that they override the allocation and deallocation processes. If this is true, might they happen to store the line of code that last freed a section of memory so that when it later crashes because of an access violation, you know what freed it last?
具体细节:
Windows中,ANSI C,使用Visual Studio
Specifics:Windows, ANSI C, using Visual Studio
推荐答案
是的!
安装,并使用<一个href=\"http://www.microsoft.com/downloads/details.aspx?FamilyID=c4a25ab9-649d-4a1b-b4a7-c9d8b095df18&displaylang=en\"相对=nofollow>应用程序验证。
- 文件 - >添加应用程序,选择您的.exe
- 在基础知识,选择记忆和堆。
- 在NTSD(NTSD yourprogram.exe)运行程序的调试版本。
- 重现错误。
现在当你崩溃发生,你会得到从AppVerifier的调试器附加信息。使用!avrf(可能需要很长的时间来运行(分钟)),它会尝试给你尽可能多的有用信息。
Now when you make the crash happen, you will get additional information in the debugger from AppVerifier. Use !avrf (may take a long time to run (minutes)) and it will try to give you as much useful information as possible.
您都可以使用的内存地址的dps命令来获取所有存储堆栈信息(分配,释放,等等)。
You can all use the dps command on the memory address to get all the stored stack info (allocation, deallocation, etc).
您还可以在内存地址使用堆命令:!
You can also use the !heap command on the memory address:
0:004> !heap -p -a 0x0C46CFE0
这将转储信息,以及。
Which will dump information as well.
延伸阅读:
- Advanced Windows Debugging, Hewardt and Pravat
- Debugging with PageHeap
这篇关于寻找记忆的地方上次释放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!