• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
yewbie

Strange issue with default deconstructors

9 posts in this topic

I have a textureloader I made awhile back to dynamically load textures etc etc, well it has always worked fine up until about a week ago.
Now I never changed anything with my textureloader but now on exit of my game as it runs through all the default deconstructors it will sometimes crash when de-allocating a string!

I included the callstack here, I know some of these error messages can be very cryptic, but it just looks like its trying to release a string?
Any help, or any idea about how to go about debugging this would be greatly appreciated!

Unhandled exception at 0x63eaad4a (msvcp100d.dll) in AlphaProjectV2.exe: 0xC0000005: Access violation reading location 0x00000005.
> msvcp100d.dll!std::_Container_base12::_Orphan_all() Line 201 + 0x12 bytes C++

Here is the callstack
[code]> msvcp100d.dll!std::_Container_base12::_Orphan_all() Line 201 + 0x12 bytes C++
AlphaProjectV2.exe!std::_String_val<char,std::allocator<char> >::~_String_val<char,std::allocator<char> >() Line 478 + 0xb bytes C++
AlphaProjectV2.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 755 + 0xf bytes C++
AlphaProjectV2.exe!TEXTUREMANAGER::~TEXTUREMANAGER() + 0x66 bytes C++
AlphaProjectV2.exe!GamePlayGraphics::~GamePlayGraphics() + 0xc6 bytes C++
AlphaProjectV2.exe!GraphicsEngine::~GraphicsEngine() + 0x69 bytes C++
AlphaProjectV2.exe!Game::~Game() + 0x78 bytes C++
AlphaProjectV2.exe!`dynamic atexit destructor for 'MyGame''() + 0x28 bytes C++
msvcr100d.dll!doexit(int code, int quick, int retcaller) Line 567 C
msvcr100d.dll!exit(int code) Line 393 + 0xd bytes C
AlphaProjectV2.exe!__tmainCRTStartup() Line 568 C
AlphaProjectV2.exe!WinMainCRTStartup() Line 371 C
kernel32.dll!767a339a()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!77b09ed2()
ntdll.dll!77b09ea5()
[/code]

Also the only string in that whole class is the filename and its not anything special.
string Filename; //file name for reloading
0

Share this post


Link to post
Share on other sites
[quote name='jmastro' timestamp='1318519529' post='4872217']
The problem may actually lie elsewhere...maybe you're corrupting memory in other code. I'd check any changes made around the time that this started happening.
[/quote]

Thanks for the reply, I will check.
Mostly it was pathfinding stuff that I added, good to know that it could be somewhere else though... That dramatically expands my search =p
0

Share this post


Link to post
Share on other sites
I have couple ideas..

Do you use raw pointers to store any of those classes as data members? If so, double check all resource handling, at least Copy constructors, destructors and assignment operators. Implicitly generated do not work. Try to set the pointers to zero if you are manually deleting anything, just to rule out any double deletion issues.

Verify that you're not messing with what c_str() returns to you.
0

Share this post


Link to post
Share on other sites
Have you rewritten anything to do with your allocator? I know often the problems are more sporadic and less tested when the allocator deallocates, and depending on how your program exits you may never run into problems.
0

Share this post


Link to post
Share on other sites
[quote name='way2lazy2care' timestamp='1318595233' post='4872494']
Have you rewritten anything to do with your allocator? I know often the problems are more sporadic and less tested when the allocator deallocates, and depending on how your program exits you may never run into problems.
[/quote]

I've gone over my texture loader class over and over and I really don't see anything that would cause that (its not a very big class)
I am just going to comment large portions of code to narrow it down, I just wish the debug output would give me more hints =p

Edit: and to answer your question, many of my allocators have changed since this problem cropped up but textureloader has not changed.
0

Share this post


Link to post
Share on other sites
If you've spent more than a few hours on this, here's what I would do:

1) assume a bug elsewhere in your code is overwriting the pointer stored by the string, or other similar source of heap corruption

2) assume that if you were going to find the bug by examination, you would have already done so - you are looking at your diffs, right?

3) use [url="http://msdn.microsoft.com/en-us/library/ff549557(v=vs.85).aspx"]gflags[/url] to temporarily enable 'full heap' option for your process so that you're more likely to get an actual access violation when your heap corruption occurs

Actually, read [url="https://docs.google.com/viewer?a=v&q=cache:F_lSH9xS7CYJ:daviddahlbacka.com/BugCleaner/DebuggingHeapCorruption.doc+gflags+postmortem&hl=en&gl=uk&pid=bl&srcid=ADGEESgmCSRsQy4n3uyY17X4IBXNCbUlelrDj4PVPMzMgq6vFEPwTZFXdgSoyvPW44oKn7hHlCjPYLYuh83MkhYqi05fke71LG8fIF40EXuOm-oi2qkvQetfe8XFF4qK7wT41ArxFHjR&sig=AHIEtbRyKk8fYrt1HjzCwrxM55uS74sQdg&pli=1"]this document[/url]

4) remember to switch it off again

5) wonder why there isn't a button for this relatively common task in visual studio [img]http://public.gamedev.net/public/style_emoticons/default/cool.gif[/img]
2

Share this post


Link to post
Share on other sites
[quote name='mrbastard' timestamp='1318610457' post='4872571']
3) use [url="http://msdn.microsoft.com/en-us/library/ff549557%28v=vs.85%29.aspx"]gflags[/url] to temporarily enable 'full heap' option for your process so that you're more likely to get an actual access violation when your heap corruption occurs
[/quote]

I love you, I never even knew this existed!
I found it, I was writing to a array:
int MapPath[200][200]
using a formula to get my cordinates, well due to a quirk in how I wrote my formula I would sometimes get a result outside of my range of 200.
I have fixed the offending formula, I have added range checking, not sure why I didn't to being with!

edit: I love the disclaimer on the bottom of the glflags page:
[b]Note[/b] Incorrect use of this tool can degrade system performance or prevent Windows from starting, requiring you to reinstall Windows.
1

Share this post


Link to post
Share on other sites
[quote name='yewbie' timestamp='1318611115' post='4872578']
I love you, I never even knew this existed!
[/quote]

HTH. Yeah, it's one of those tricks that deserves to be much more well known, given the incredible amount of time it can save.

[img]http://public.gamedev.net/public/style_emoticons/default/smile.gif[/img]

[quote name='yewbie' timestamp='1318611115' post='4872578']
edit: I love the disclaimer on the bottom of the glflags page:
[b]Note[/b] Incorrect use of this tool can degrade system performance or prevent Windows from starting, requiring you to reinstall Windows.
[/quote]
Wow. You'd think they'd reset the flags on restart [img]http://public.gamedev.net/public/style_emoticons/default/ohmy.gif[/img]

1

Share this post


Link to post
Share on other sites
Please note that they are not called "deconstructors", they are called "destructors".

To deconstruct is to take apart, to destruct is to destroy.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0