Fortify for memory leakage
Fortify for memory leakage
Hi,
Did anyone succeeded in getting Fortify to show memory leakages with showing file and line number where it occurs using visual studio 2005?
Did anyone succeeded in getting Fortify to show memory leakages with showing file and line number where it occurs using visual studio 2005?
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I'm not really sure why the compiler/IDE would be relevant. We're talking about this Fortify, yes? What problems are you having with it?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Hi,
Yes, that Fortify. The problem is, it's not showing me any memory leakage in the output window of my IDE.
The documentation of Fortify says that it might not work for your compiler/IDE, then i would have to adjust something for Fortify to recognize my compiler/IDE.
That's why the compiler/IDE is relevant i guess.
I placed this function:
Just right at the start of my main function
And ended my main just in front of the return 0, with this function:
No .log file is made and nothing in my output window.
What am i doing wrong?
Yes, that Fortify. The problem is, it's not showing me any memory leakage in the output window of my IDE.
The documentation of Fortify says that it might not work for your compiler/IDE, then i would have to adjust something for Fortify to recognize my compiler/IDE.
That's why the compiler/IDE is relevant i guess.
I placed this function:
Code: Select all
Fortify_EnterScope();
Just right at the start of my main function
And ended my main just in front of the return 0, with this function:
Code: Select all
Fortify_LeaveScope();
No .log file is made and nothing in my output window.
What am i doing wrong?
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Heh, you're right; it is an IDE issue.
You'll want to add an OutputDebugString() in there if you want it to come out in the debugger's output. It should appear in a console though; have you suppressed the console?
Code: Select all
static void
st_DefaultOutput(const char *String)
{
fprintf(stdout, String);
fflush(stdout);
}
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
rogerborg wrote:Heh, you're right; it is an IDE issue.
You'll want to add an OutputDebugString() in there if you want it to come out in the debugger's output. It should appear in a console though; have you suppressed the console?Code: Select all
static void st_DefaultOutput(const char *String) { fprintf(stdout, String); fflush(stdout); }
Hi,
Once i press the ESC button, my game is closed. The console gets closed too. But i have implemented:
Code: Select all
system("pause");
Unfortunately, that wasn't the case.
The debug tool of microsoft does show me that memory leakage happens but not the lines where it occurs because i am not using "new" or "malloc" to allocate memory.
I am not sure what to do with the functions you provided. They expect a string as an argument.
It's another method to do it but maybe you'll find it useful:
http://forums.microsoft.com/MSDN/ShowPo ... 4&SiteID=1
http://www.codeguru.com/forum/archive/i ... 12742.html
http://osdir.com/ml/lib.wxwindows.gener ... ml?rfp=dta
I haven't read them yet but they're open in the tabs since I found them (few days ago) waiting to be learned..
http://forums.microsoft.com/MSDN/ShowPo ... 4&SiteID=1
http://www.codeguru.com/forum/archive/i ... 12742.html
http://osdir.com/ml/lib.wxwindows.gener ... ml?rfp=dta
I haven't read them yet but they're open in the tabs since I found them (few days ago) waiting to be learned..
Visual Leak Detector
http://dmoulding.googlepages.com/vld
Easier and better, IMO, then Purify or any other solutions.
You simply #include <vld.h> and any output that Visual Studio would normally report will have more information.
http://dmoulding.googlepages.com/vld
Easier and better, IMO, then Purify or any other solutions.
You simply #include <vld.h> and any output that Visual Studio would normally report will have more information.
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I'm almost afraid to ask how you're allocating memory if it's not with new() or malloc().Yustme wrote:The debug tool of microsoft does show me that memory leakage happens but not the lines where it occurs because i am not using "new" or "malloc" to allocate memory.
OK, have you read the Fortify manual?
If so, then I suggest that you set breakpoints in the fortify functions (e.g. Fortify_malloc()) and check that they're actually being called. If not, then there's something hooky in your setup, and you need to RTFM a bit more.To install Fortify, each source file will need to #include "fortify.h".
To enable Fortify, define the symbol FORTIFY. The makefile is the best
place to do this. The symbol FORTIFY will need to be defined for every
module, this includes "fortify.c" or "fortify.cxx"
If you do not have stdout available, you may wish to set an alternative
output function. See Fortify_SetOutputFunc() and FORTIFY_AUTOMATIC_LOGFILE, below.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
What does that mean in simple words?:Spintz wrote:Visual Leak Detector
http://dmoulding.googlepages.com/vld
Easier and better, IMO, then Purify or any other solutions.
You simply #include <vld.h> and any output that Visual Studio would normally report will have more information.
Code: Select all
// Force a symbolic reference to the global VisualLeakDetector class object from
// the DLL. This enusres that the DLL is loaded and linked with the program,
// even if no code otherwise imports any of the DLL's exports.
#pragma comment(linker, "/include:__imp_?vld@@3VVisualLeakDetector@@A")
When I run it I get a massive list of so called memory leaks but I don't understand how to read it, it just show me many places of my code..
Something like that:
Code: Select all
WARNING: Visual Leak Detector detected memory leaks!
---------- Block 287 at 0x01C738C8: 60 bytes ----------
Call Stack:
d:\programming\projects\active projects\visual studio 2008\nusoftware products\svn\nusoftware game engine sdk\trunk\source\nusoftware game engine\core\cgamemanager.cpp (153): nge::CGameManager::Init
d:\programming\projects\active projects\visual studio 2008\nusoftware products\svn\nusoftware game engine sdk\trunk\source\nusoftware game engine\core\cgamemanager.cpp (43): nge::CGameManager::CGameManager
d:\programming\projects\active projects\visual studio 2008\nusoftware products\svn\nusoftware game engine sdk\trunk\source\nusoftware game engine\core\cgame.cpp (8): nge::CGame::CGame
d:\programming\projects\active projects\visual studio 2008\nusoftware products\svn\nusoftware game engine sdk\trunk\examples\01.helloworld\helloworld.cpp (9): main
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (266): mainCRTStartup
f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (182): mainCRTStartup
0x7C816FD7 (File and line number not available): RegisterWaitForInputIdle
Data:
70 54 4F 00 94 54 4F 00 50 EF 3A 00 58 6C 3A 00 pTO..TO. P.:.Xl:.
E8 81 3A 00 C0 60 C7 01 01 00 00 00 01 00 00 00 ..:..`.. ........
01 00 CD CD E4 54 4F 00 10 66 9C 02 01 00 00 00 .....TO. .f......
64 54 4F 00 01 00 00 00 00 00 00 00 dTO..... ........
Hi,Spintz wrote:Visual Leak Detector
http://dmoulding.googlepages.com/vld
Easier and better, IMO, then Purify or any other solutions.
You simply #include <vld.h> and any output that Visual Studio would normally report will have more information.
I have tried vld a few days back. It runs my game very slow, I get 3 FPS.
When i close my game, it says "no memory leaks detected". While the MS debug tool shows at least 4 MB (after counting them all).
rogerborg wrote:I'm almost afraid to ask how you're allocating memory if it's not with new() or malloc().Yustme wrote:The debug tool of microsoft does show me that memory leakage happens but not the lines where it occurs because i am not using "new" or "malloc" to allocate memory.
OK, have you read the Fortify manual?
If so, then I suggest that you set breakpoints in the fortify functions (e.g. Fortify_malloc()) and check that they're actually being called. If not, then there's something hooky in your setup, and you need to RTFM a bit more.To install Fortify, each source file will need to #include "fortify.h".
To enable Fortify, define the symbol FORTIFY. The makefile is the best
place to do this. The symbol FORTIFY will need to be defined for every
module, this includes "fortify.c" or "fortify.cxx"
If you do not have stdout available, you may wish to set an alternative
output function. See Fortify_SetOutputFunc() and FORTIFY_AUTOMATIC_LOGFILE, below.
Hi,
I just get a few pointers like the device and driver.
Do you use "malloc" or "new" for that?