本文介绍了现代相当于Visual Studio 2008的BoundsChecker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VS6次有​​来自Numega的BoundsChecker。我明白它现在已经死了,请纠正我,如果我错了。什么是可靠的替代品?最好免费或至少有试用版本。

In VS6 times there was BoundsChecker from Numega. I understand it is dead now, please correct me if I am wrong. What are the reliable alternatives? Preferably free or at least with trial version available.

推荐答案

IMO写一个自定义内存管理器支持new / delete / malloc / free包装器)。使用VirtualProtect创建一个新的/删除包装器锁定未使用/释放的内存(是的,我知道默认分配块将必须是PAGE_SIZE字节大,你需要很多的ram,即使对于一个小应用程序,但这是唯一的坏处)。如果你在linux上,它可能有VirtualProtect替代。在这种情况下,任何超出界限的访问将生成访问冲突,并将很容易跟踪。还可以使用stl容器 - 它们还提供边界检查。

IMO It might be a better idea to write custom memory manager (the one that supports new/delete/malloc/free wrappers). Make a new/delete wrapper that locks unused/freed memory using VirtualProtect (yeah, I know that default allocation block will have to be PAGE_SIZE bytes large, and you'll need a lot of ram even for a small app, but that's the only disadvantage). If you are on linux, it probably have VirtualProtect alternative. In this case any outrageous out-of-bounds access will generate access violation and will be easy to track. Also use stl containers when possible - they also offer bounds checking.

这个建议是基于经验 - 我曾经使用了一个可怕的写的巨大(几兆字节代码)老软件有内存泄漏,访问已经释放的内存从多个线程等。我花了一周的时间尝试不同的实用程序(purify,devpartner工作室,aqtime等),虽然其中一些提供了大量的信息,没有一个是真正有用的。自定义内存管理问题在2天后被删除(包括写内存管理器)。

This advice is based on experience - I had worked with a terribly written huge (several megabytes of code) old software that had memory leaks, accessed already freed memory from multiple threads and so on. I've spent week trying different utilities (purify, devpartner studio, aqtime etc), and although some of them provided loads of information, none were really helpful. With custom memory managment problems were eliminated in 2 days (that includes writing memory manager).

如果这不适合你,请试试compuware devpartner studio - 如果是仍可在任何地方使用。

If that doesn't work for you, try compuware devpartner studio - if it is still available anywhere.

这篇关于现代相当于Visual Studio 2008的BoundsChecker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 16:11