Visual Studio 有类似 Borland 的 CodeGuard 的东西吗?

发布于 2024-07-08 20:34:53 字数 1435 浏览 8 评论 0 原文

Visual Studio中有没有像Codeguard一样报告内存泄漏的东西?

例如:

Error 00001. 0x300010 (Thread 0x0FA4):
Resource leak: The object (0xC65D84) was never deleted

The object (0x00C65D84) [size: 4 bytes] was created with new
| element2.cpp line 3:
| #include "element2.h"
| 
|>CS225::Element2::Element2(int _val) : p_val(new int(_val)) { }
| 
| CS225::Element2::Element2(const Element2& rhs) 
Call Tree:
   0x0040E3A7(=bcc_cg.exe:0x01:00D3A7) element2.cpp#3
   0x00409116(=bcc_cg.exe:0x01:008116) element-factory.h#19
   0x0040D964(=bcc_cg.exe:0x01:00C964) array.cpp#87
   0x00405308(=bcc_cg.exe:0x01:004308) driver.cpp#394
   0x004054B5(=bcc_cg.exe:0x01:0044B5) driver.cpp#415
   0x00405522(=bcc_cg.exe:0x01:004522) driver.cpp#420

------------------------------------------
Error 00002. 0x300010 (Thread 0x0FA4):
Resource leak: The object (0xC65D58) was never deleted

The object (0x00C65D58) [size: 4 bytes] was created with new
| element2.cpp line 6:
| 
| CS225::Element2::Element2(const Element2& rhs) 
|>  : AbstractElement(), p_val(new int(*rhs.p_val)) 
| { }
| 
Call Tree:
   0x0040E4B7(=bcc_cg.exe:0x01:00D4B7) element2.cpp#6
   0x0040E652(=bcc_cg.exe:0x01:00D652) element2.cpp#26
   0x0040D8CD(=bcc_cg.exe:0x01:00C8CD) array.cpp#81
   0x00405308(=bcc_cg.exe:0x01:004308) driver.cpp#394
   0x004054B5(=bcc_cg.exe:0x01:0044B5) driver.cpp#415
   0x00405522(=bcc_cg.exe:0x01:004522) driver.cpp#420

Is there anything in Visual Studio that will report memory leaks like Codeguard?

eg:

Error 00001. 0x300010 (Thread 0x0FA4):
Resource leak: The object (0xC65D84) was never deleted

The object (0x00C65D84) [size: 4 bytes] was created with new
| element2.cpp line 3:
| #include "element2.h"
| 
|>CS225::Element2::Element2(int _val) : p_val(new int(_val)) { }
| 
| CS225::Element2::Element2(const Element2& rhs) 
Call Tree:
   0x0040E3A7(=bcc_cg.exe:0x01:00D3A7) element2.cpp#3
   0x00409116(=bcc_cg.exe:0x01:008116) element-factory.h#19
   0x0040D964(=bcc_cg.exe:0x01:00C964) array.cpp#87
   0x00405308(=bcc_cg.exe:0x01:004308) driver.cpp#394
   0x004054B5(=bcc_cg.exe:0x01:0044B5) driver.cpp#415
   0x00405522(=bcc_cg.exe:0x01:004522) driver.cpp#420

------------------------------------------
Error 00002. 0x300010 (Thread 0x0FA4):
Resource leak: The object (0xC65D58) was never deleted

The object (0x00C65D58) [size: 4 bytes] was created with new
| element2.cpp line 6:
| 
| CS225::Element2::Element2(const Element2& rhs) 
|>  : AbstractElement(), p_val(new int(*rhs.p_val)) 
| { }
| 
Call Tree:
   0x0040E4B7(=bcc_cg.exe:0x01:00D4B7) element2.cpp#6
   0x0040E652(=bcc_cg.exe:0x01:00D652) element2.cpp#26
   0x0040D8CD(=bcc_cg.exe:0x01:00C8CD) array.cpp#81
   0x00405308(=bcc_cg.exe:0x01:004308) driver.cpp#394
   0x004054B5(=bcc_cg.exe:0x01:0044B5) driver.cpp#415
   0x00405522(=bcc_cg.exe:0x01:004522) driver.cpp#420

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱要勇敢去追 2024-07-15 20:34:53

内置的,没有。 它有 >,但它并不像您的示例所暗示的那么全面。 有多种附加组件提供此功能。 Boundschecker 是一种众所周知且流行的工具。

Built in, no. It has <crtdbg.h>, but it's not as comprehensive as implied by your example. There are various add-ons that provide this functionality. Boundschecker is a well-known and popular one.

本王不退位尔等都是臣 2024-07-15 20:34:53

Visual Leak Detector 听起来不错。 不过我自己还没有尝试过。

Visual Leak Detector sounds pretty good. I haven't tried it myself, though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文