Thread: [GD-General] memory checking
Brought to you by:
vexxed72
From: Brett B. <res...@ga...> - 2004-03-05 03:38:43
|
I recently ran into a serious memory bug I just can't track down and it = seems it's time to get some sort of memory debugging tool. Ideally it = would be available for Win32, PS2 and GameCube and work with = CodeWarrior, but just Windows would be acceptable. The only tools I can = find so far are BoundsChecker and Purify, but neither looks like it will = work with our CodeWarrior setup. I also tried just using the crtdbg = funcitons, but getting the MS libs into CodeWarrior is proving = problematic. Does anybody know of any commercial product that might be useful? Are = there any standalone memory checkers out there? Anybody using = BoundsChecker that can comment on whether you must have Visual Studio or = not? Thanks, Brett |
From: brian s. <pud...@po...> - 2004-03-05 04:17:54
|
You can probably get what you need writing your own - I imagine that's what most cross-platform and console people end up doing. It's what I did. It's easy. Assuming you have all the C allocation functions inside your own wrappers, you adjust all allocations to allocate a larger block, add guard bytes at the start and end of the block, and return a pointer to the inside of the block (you'll want to add enough bytes at the front to guarantee the same alignment that your platform's malloc delivers). You'll want to put a reference to the source file and line in that header block too, so you can see where the trashed pointer comes from. Then when the pointer's freed, you just check those guard bytes and see if they're trashed, before calling the actual free function (with the pointer adjusted downward, of course). You can also keep a list of all the pointers you've alloc'ed, and write a function that walks over all of them looking for damage. And if you have a list of all outstanding pointers, with file/line pairs, you can even start checking for leaks, if you're so inclined :) You can do fancier stuff on Win32 and Xbox, like putting allocations in separate pages and using page protections to detect overruns immediately. BoundsChecker probably does that (along with all sorts of other stuff). But it's usually enough to be able to see which pointer got nuked. If it's reproducible, you can watch a particular address in the debugger to see when it gets hit. Hope this helps, --brian Brett Bibby wrote: >I recently ran into a serious memory bug I just can't track down and it seems it's time to get some sort of memory debugging tool. Ideally it would be available for Win32, PS2 and GameCube and work with CodeWarrior, but just Windows would be acceptable. The only tools I can find so far are BoundsChecker and Purify, but neither looks like it will work with our CodeWarrior setup. I also tried just using the crtdbg funcitons, but getting the MS libs into CodeWarrior is proving problematic. > >Does anybody know of any commercial product that might be useful? Are there any standalone memory checkers out there? Anybody using BoundsChecker that can comment on whether you must have Visual Studio or not? > >Thanks, >Brett > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click >_______________________________________________ >Gamedevlists-general mailing list >Gam...@li... >https://lists.sourceforge.net/lists/listinfo/gamedevlists-general >Archives: >http://sourceforge.net/mailarchive/forum.php?forum_idU7 > > > |
From: Daniel V. <vo...@ep...> - 2004-03-05 04:38:47
|
Won't really help you (gotta love posts that start like this ;)) as it's Linux only though Valgrind is a godsend for this purpose - http://valgrind.kde.org/. I wish someone would either port it to Windows = or create an equivalently useful product.=20 I tried BoundsChecker in the past though wasn't happy with it as it = requires instrumentation which didn't work in conjunction with our engine. -- Daniel, Epic Games Inc. =20 > -----Original Message----- > From: gam...@li...=20 > [mailto:gam...@li...] On=20 > Behalf Of Brett Bibby > Sent: Thursday, March 04, 2004 10:34 PM > To: Gam...@li... > Subject: [GD-General] memory checking >=20 > I recently ran into a serious memory bug I just can't track=20 > down and it seems it's time to get some sort of memory=20 > debugging tool. Ideally it would be available for Win32, PS2=20 > and GameCube and work with CodeWarrior, but just Windows=20 > would be acceptable. The only tools I can find so far are=20 > BoundsChecker and Purify, but neither looks like it will work=20 > with our CodeWarrior setup. I also tried just using the=20 > crtdbg funcitons, but getting the MS libs into CodeWarrior is=20 > proving problematic. >=20 > Does anybody know of any commercial product that might be=20 > useful? Are there any standalone memory checkers out there?=20 > Anybody using BoundsChecker that can comment on whether you=20 > must have Visual Studio or not? >=20 > Thanks, > Brett >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=CCk > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU7 >=20 |
From: Brett B. <res...@ga...> - 2004-03-05 05:03:05
|
Thanks guys for your notes. Since we have a memory corruption our memory = wrappers didn't pick up on the error. I'll look into some of the fancy = stuff Brian mentioned. I heard good things about valgrind but alas it's = only linux. Hmm, a port... maybe something to think about. I did find = HeapAgent http://www.microquill.com/mqplatfm.htm interesting but the = demo version told me less than CodeWarrior about the problem :)=20 Cheers, Brett ----- Original Message -----=20 From: "Daniel Vogel" <vo...@ep...> To: <gam...@li...> Sent: Friday, March 05, 2004 12:32 PM Subject: RE: [GD-General] memory checking > Won't really help you (gotta love posts that start like this ;)) as = it's > Linux only though Valgrind is a godsend for this purpose - > http://valgrind.kde.org/. I wish someone would either port it to = Windows or > create an equivalently useful product.=20 >=20 > I tried BoundsChecker in the past though wasn't happy with it as it = requires > instrumentation which didn't work in conjunction with our engine. >=20 > -- Daniel, Epic Games Inc. =20 >=20 > > -----Original Message----- > > From: gam...@li...=20 > > [mailto:gam...@li...] On=20 > > Behalf Of Brett Bibby > > Sent: Thursday, March 04, 2004 10:34 PM > > To: Gam...@li... > > Subject: [GD-General] memory checking > >=20 > > I recently ran into a serious memory bug I just can't track=20 > > down and it seems it's time to get some sort of memory=20 > > debugging tool. Ideally it would be available for Win32, PS2=20 > > and GameCube and work with CodeWarrior, but just Windows=20 > > would be acceptable. The only tools I can find so far are=20 > > BoundsChecker and Purify, but neither looks like it will work=20 > > with our CodeWarrior setup. I also tried just using the=20 > > crtdbg funcitons, but getting the MS libs into CodeWarrior is=20 > > proving problematic. > >=20 > > Does anybody know of any commercial product that might be=20 > > useful? Are there any standalone memory checkers out there?=20 > > Anybody using BoundsChecker that can comment on whether you=20 > > must have Visual Studio or not? > >=20 > > Thanks, > > Brett > >=20 > >=20 > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IBM Linux Tutorials > > Free Linux tutorial presented by Daniel Robbins, President and CEO = of > > GenToo technologies. Learn everything from fundamentals to system > > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=CCk > > _______________________________________________ > > Gamedevlists-general mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_idU7 > >=20 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=CCk > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU7 |
From: Mike W. <mi...@ge...> - 2004-03-05 06:10:33
|
does anyone have any suggestions for open-source applications for=20 debugging memory leaks on windows? we can't afford the license fees for=20 bounds checker etc unfortunately. mike w www.gekidodesigns.com Brett Bibby wrote: > Thanks guys for your notes. Since we have a memory corruption our memor= y wrappers didn't pick up on the error. I'll look into some of the fancy = stuff Brian mentioned. I heard good things about valgrind but alas it's o= nly linux. Hmm, a port... maybe something to think about. I did find Heap= Agent http://www.microquill.com/mqplatfm.htm interesting but the demo ver= sion told me less than CodeWarrior about the problem :)=20 > Cheers, > Brett >=20 > ----- Original Message -----=20 > From: "Daniel Vogel" <vo...@ep...> > To: <gam...@li...> > Sent: Friday, March 05, 2004 12:32 PM > Subject: RE: [GD-General] memory checking >=20 >=20 >=20 >>Won't really help you (gotta love posts that start like this ;)) as it'= s >>Linux only though Valgrind is a godsend for this purpose - >>http://valgrind.kde.org/. I wish someone would either port it to Window= s or >>create an equivalently useful product.=20 >> >>I tried BoundsChecker in the past though wasn't happy with it as it req= uires >>instrumentation which didn't work in conjunction with our engine. >> >>-- Daniel, Epic Games Inc. =20 >> >> >>>-----Original Message----- >>>From: gam...@li...=20 >>>[mailto:gam...@li...] On=20 >>>Behalf Of Brett Bibby >>>Sent: Thursday, March 04, 2004 10:34 PM >>>To: Gam...@li... >>>Subject: [GD-General] memory checking >>> >>>I recently ran into a serious memory bug I just can't track=20 >>>down and it seems it's time to get some sort of memory=20 >>>debugging tool. Ideally it would be available for Win32, PS2=20 >>>and GameCube and work with CodeWarrior, but just Windows=20 >>>would be acceptable. The only tools I can find so far are=20 >>>BoundsChecker and Purify, but neither looks like it will work=20 >>>with our CodeWarrior setup. I also tried just using the=20 >>>crtdbg funcitons, but getting the MS libs into CodeWarrior is=20 >>>proving problematic. >>> >>>Does anybody know of any commercial product that might be=20 >>>useful? Are there any standalone memory checkers out there?=20 >>>Anybody using BoundsChecker that can comment on whether you=20 >>>must have Visual Studio or not? >>> >>>Thanks, >>>Brett >>> >>> >>>------------------------------------------------------- >>>This SF.Net email is sponsored by: IBM Linux Tutorials >>>Free Linux tutorial presented by Daniel Robbins, President and CEO of >>>GenToo technologies. Learn everything from fundamentals to system >>>administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=CCk >>>_______________________________________________ >>>Gamedevlists-general mailing list >>>Gam...@li... >>>https://lists.sourceforge.net/lists/listinfo/gamedevlists-general >>>Archives: >>>http://sourceforge.net/mailarchive/forum.php?forum_idU7 >>> >> >> >> >>------------------------------------------------------- >>This SF.Net email is sponsored by: IBM Linux Tutorials >>Free Linux tutorial presented by Daniel Robbins, President and CEO of >>GenToo technologies. Learn everything from fundamentals to system >>administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=CCk >>_______________________________________________ >>Gamedevlists-general mailing list >>Gam...@li... >>https://lists.sourceforge.net/lists/listinfo/gamedevlists-general >>Archives: >>http://sourceforge.net/mailarchive/forum.php?forum_idU7 >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id638&op=CCk > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_idU7 >=20 >=20 |
From: Ivan-Assen I. <as...@ha...> - 2004-03-05 06:25:10
|
> does anyone have any suggestions for open-source applications for > debugging memory leaks on windows? we can't afford the > license fees for > bounds checker etc unfortunately. Hi, I've seen Boehm's gargabage collector for C successfully used for leaks hunting. (ifl://boehm+garbage+collector) But of course, it won't catch overruns or random memory damages. We tried BoundsChecker once, but it was so unhappy with our own debug memory manager that it was unusable, reporting thousands of non-leaks as leaks etc. |
From: Eero P. <epa...@ko...> - 2004-03-05 07:52:26
|
Mike Wuetherick wrote: > does anyone have any suggestions for open-source applications for > debugging memory leaks on windows? we can't afford the license fees for > bounds checker etc unfortunately. > I have previously used Boehm garbage collector, tuned for leak detection, but now I am mostly using Glowcode, which is not free but relatively low cost. I do have a major problem with Glowcode though, when combined with Nvidia geforce display adapter (and my OpenGL using program), it can freeze WindowsXP completely. Has anybody seen this, and been able to avoid it? I suspect that the Nvidia adapter maps out some registers which do not tolerate the scanning by the leak detector (?) (Apologies for being somewhat off topic, maybe this should be moved to gamedev-windows?) Eero |
From: Timo H. <ma...@ti...> - 2004-03-05 07:33:06
|
Hi Brett, what about Paul Nettle's free Memory Manager: http://www.flipcode.com/cgi-bin/msg.cgi?showThread=12September2000-PresentingAMemoryManager&forum=askmid&id=-1 it is: - free - simple to use (just put in the files into your project and include the header in all your files) Timo Brett wrote: > I recently ran into a serious memory bug I just can't track down and it seems it's time to get some sort of memory debugging tool. Ideally it would be available for Win32, PS2 and GameCube and work > with CodeWarrior, but just Windows would be acceptable. The only tools I can find so far are BoundsChecker and Purify, but neither looks like it will work with our CodeWarrior setup. I also tried > just using the crtdbg funcitons, but getting the MS libs into CodeWarrior is proving problematic. > Does anybody know of any commercial product that might be useful? Are there any standalone memory checkers out there? Anybody using BoundsChecker that can comment on whether you must have Visual > Studio or not? > Thanks, > Brett |
From: Brett B. <res...@ga...> - 2004-03-05 07:59:53
|
Thanks for the note Timo. I had a quick look and it is certainly = something I'll look into. The problem with it specifically is that it's = C++ and I need something in C and highly portable and endian friendly = for PS2 and GameCube. We have a build of Doug Lea's malloc = (http://gee.cs.oswego.edu/dl/) and I probably would be best served by = trying to put a memory leak debugger inside that. I'm not really = excited about switching memory managers until I can find this bug though = in case it magically disappears :) Cheers, Brett ----- Original Message -----=20 From: "Timo Heister" <ma...@ti...> To: "Brett Bibby" <gam...@li...> Sent: Friday, March 05, 2004 3:25 PM Subject: Re: [GD-General] memory checking > Hi Brett, >=20 > what about Paul Nettle's free Memory Manager: > = http://www.flipcode.com/cgi-bin/msg.cgi?showThread=3D12September2000-Pres= entingAMemoryManager&forum=3Daskmid&id=3D-1 >=20 > it is: > - free > - simple to use (just put in the files into your project and include > the header in all your files) >=20 > Timo >=20 > Brett wrote: >=20 > > I recently ran into a serious memory bug I just can't track down and = it seems it's time to get some sort of memory debugging tool. Ideally it = would be available for Win32, PS2 and GameCube and work > > with CodeWarrior, but just Windows would be acceptable. The only = tools I can find so far are BoundsChecker and Purify, but neither looks = like it will work with our CodeWarrior setup. I also tried > > just using the crtdbg funcitons, but getting the MS libs into = CodeWarrior is proving problematic. >=20 > > Does anybody know of any commercial product that might be useful? = Are there any standalone memory checkers out there? Anybody using = BoundsChecker that can comment on whether you must have Visual > > Studio or not? >=20 > > Thanks, > > Brett >=20 >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > = administration.http://ads.osdn.com/?ad_id=3D1470&alloc_id=3D3638&op=3Dcli= ck > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D557 |
From: ReJ <re...@sc...> - 2004-03-08 17:08:24
|
Hi Timo, be aware of new and delete redefinition in Paul Nettle's Memory Manager: mmgr.h #define new (m_setOwner (__FILE__,__LINE__,__FUNCTION__),false) ? NULL : new #define delete (m_setOwner (__FILE__,__LINE__,__FUNCTION__),false) ? m_setOwner("",0,"") : delete This may cause problems if you are defining your new/delete operators or using libraries like std or boost. There are some solutions discussed in thread topic, however it's not always possible. ReJ aka Renaldas Zioma www.nesnausk.org ----- Original Message ----- From: "Timo Heister" <ma...@ti...> To: "Brett Bibby" <gam...@li...> Sent: Friday, March 05, 2004 9:25 AM Subject: Re: [GD-General] memory checking > Hi Brett, > > what about Paul Nettle's free Memory Manager: > http://www.flipcode.com/cgi-bin/msg.cgi?showThread=12September2000-Presentin gAMemoryManager&forum=askmid&id=-1 > > it is: > - free > - simple to use (just put in the files into your project and include > the header in all your files) > > Timo > > Brett wrote: > > > I recently ran into a serious memory bug I just can't track down and it seems it's time to get some sort of memory debugging tool. Ideally it would be available for Win32, PS2 and GameCube and work > > with CodeWarrior, but just Windows would be acceptable. The only tools I can find so far are BoundsChecker and Purify, but neither looks like it will work with our CodeWarrior setup. I also tried > > just using the crtdbg funcitons, but getting the MS libs into CodeWarrior is proving problematic. > > > Does anybody know of any commercial product that might be useful? Are there any standalone memory checkers out there? Anybody using BoundsChecker that can comment on whether you must have Visual > > Studio or not? > > > Thanks, > > Brett > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=557 |
From: Enno R. <en...@de...> - 2004-03-05 18:24:24
Attachments:
signature.asc
|
Like the previous poster, I can highly recommend valgrind. We had some serious problems with memory bugs in our game, and tried tons of software - boundschecker, purify, insure++, heapagent - the works. In the end we rolled our own, only to find out about valgrind half a year later. Valgrind beats them all hands down. If you can reasonably port the important parts of your product to linux, go and make the effort. Enno. -- <Gibs> When you kill 6 people in Unreal Tournament it is "MonsterKill", In Quake3 it is "Excellent", in Counter-Strike it is "Kicked by console" |