Jump to content
  • Advertisement
Sign in to follow this  
utilae

String error

This topic is 4837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using C++ and Visual Studio .NET 2003. When I debug my app in visual studio debugger, it gives me these errors:
Quote:
HEAP[Project.exe]: Invalid allocation size - FEEEFF14 (exceeded 7ffdefff) First-chance exception at 0x7c81eb33 in Project.exe: Microsoft C++ exception: std::bad_alloc @ 0x0012f4e0. HEAP[Project.exe]: Invalid allocation size - FEEEFF13 (exceeded 7ffdefff) First-chance exception at 0x7c81eb33 in Project.exe: Microsoft C++ exception: std::bad_alloc @ 0x0012ee70. First-chance exception at 0x7c81eb33 in Project.exe: Microsoft C++ exception: [rethrow] @ 0x00000000. Unhandled exception at 0x7c81eb33 in Project.exe: Microsoft C++ exception: std::bad_alloc @ 0x0012ee70. The program '[776] Project.exe: Native' has exited with code 0 (0x0).
I look at the call stack (figured it out) and get to my function with this code in it:
while(itString!=lstStrings.end())
{
     //create textbox name
     g_StrStream<<"LstTextbox"<<nTextboxNameNo;
     string sListTextboxName=g_StrStream.str();//reason for crash at this line
     g_StrStream.str("");

     //add textbox
     string FontString=/*"Font1"*/itTextBox->m_sFontName;//crashes on this line
     InterfaceManager.AddInterfaceTextbox(...)
     nTextboxNameNo++;
     ++itString;
}


When I quick watch the line: string sListTextboxName=g_StrStream.str();//reason for crash at this line I find I have the following in the quick watch window: Name |Value ------------------------------- g_StrStream | {_Stringbuffer={_Seekhigh=0x00000000 <Bad Ptr> _Mystate=4 _Al={...} } } Am I right, that there is a problem on that line involving Sting Stream? The quick watch window says bad pointer. How do I fix this? How do I avoid a bad pointer in string stream?

Share this post


Link to post
Share on other sites
Advertisement
It's more likely that your bug isn't actually there, but it's a buffer overrun or some other pointer error somewhere else in your code that's corrupting the heap.

Share this post


Link to post
Share on other sites
This kind of thing has happened to me when mixing runtimes by mistake. Eg main application is compiled with "Multithreaded" and the dll using is compiled using "Multithreaded dll". So check the compile settings.

EDIT: Probably should have said where that setting is

Properities of project, C/C++ -> Code Generation -> Runtime Library.

While using Ogre, I've come upon errors with stl string initialisation and operations if I forgot to change the compiler setting to what Ogre is set too.

[Edited by - paulecoyote on August 15, 2005 9:32:12 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by paulecoyote
This kind of thing has happened to me when mixing runtimes by mistake. Eg main application is compiled with "Multithreaded" and the dll using is compiled using "Multithreaded dll". So check the compile settings.

EDIT: Probably should have said where that setting is

Properities of project, C/C++ -> Code Generation -> Runtime Library.

Ok, I've found it. Mine is set to 'Multi-Threaded Debug'.

I'll set it to 'Single-Threaded Debug' since my app is not using multiple threads or anything like that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!