Sign in to follow this  
VitaliBR

Error in std::bad_alloc (debug)

Recommended Posts

VitaliBR    147
I'm trying to understand, since I asked google for help and nothing ...
In my lib have a method of a class as follows:

[CODE]bool SDX_Model::Load(const std::string& pFile)[/CODE]

When I run my test project (for testing lib) in Debug mode in VS2010 him of this error:
[quote]Unhandled exception at 0x770615de in teste_dx.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0034efc4..[/quote]

headers in my file:
[CODE]#include <iostream>
#include <iostream>
#include <fstream>
#include <assimp/Importer.hpp> // C++ importer interface
#include <assimp/scene.h> // Output data structure
#include <assimp/postprocess.h> // Post processing flags
#include "../../include/SDX_Model.h"
#pragma comment (lib, "assimp.lib")[/CODE]

with the file (mlock.c) open and the piece of code in focus:

[CODE]/***
* _unlock - Release multi-thread lock
*
*Purpose:
* Note that it is legal for a thread to aquire _EXIT_LOCK1
* multiple times.
*
*Entry:
* locknum = number of the lock to release
*
*Exit:
*
*Exceptions:
*
*******************************************************************************/
void __cdecl _unlock (
int locknum
)
{
/*
* leave the critical section.
*/
LeaveCriticalSection( _locktable[locknum].lock );
}[/CODE]

The strange thing is that when road in Release mode, everything works OK

Share this post


Link to post
Share on other sites
kuramayoko10    390
Could you post more of your code on the .cpp file? The exact line it breaks?

Also it would be very helpful with you showed the dissasembly for this file.
Right-click on your code and select the option "Show dissasembly" or something like that on VS2010.

Share this post


Link to post
Share on other sites
BitMaster    8651
That piece of code (mlock.c) is very unlikely to be the actual problem, it is one of those places where things often fall apart when you have screwed something up before. Walk up the call stack until you reach the first code either written by yourself or Assimp. Whatever is happening there will probably give hints abouts the actual problem.

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