VC++ problem
Hi! When I run my program I get this error:
Debug Assertion Failed!
Program: Path of my program
File: dbgdel.cpp
Line : 47
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
For information on how your program can cause an assertion failure, see the VC++ documentation on asserts
What is it exactly? Shall I disable something? I don''t know what to do .. Please Help )
Bye
Looks like you''re trying to get from an empty list or something.
Try running the program in the debugger and stepping through your code to find where it''s causing the error.
Try running the program in the debugger and stepping through your code to find where it''s causing the error.
You're doign a linked list or something similar, right? I made a linked tree and got that error when deleting nodes. I have looked through my code several time and it doesn't seem to be any problem with it. My guess is that it's micro$oft who messed up.
Anyway, if you compile with release instead of debug mode, it will work.
If anyone knows what's wrong and how to fix it without compiling in release mode (since debug could be pretty handy at times) me too would like to know.
[edited by - Luctus on April 30, 2002 12:47:55 PM]
Anyway, if you compile with release instead of debug mode, it will work.
If anyone knows what's wrong and how to fix it without compiling in release mode (since debug could be pretty handy at times) me too would like to know.
[edited by - Luctus on April 30, 2002 12:47:55 PM]
Erm, I''m pretty sure VC++ doesn''t have any bugs regarding assertions. They aren''t especially complex things, so they tend to either work or not.
Perhaps you could post your code?
Perhaps you could post your code?
I think I found the problem: The error occurs when I do:
delete CurrentChunks;
This releases some memory, and the error occurs depending of the 3DS model I want to load..
delete CurrentChunks;
This releases some memory, and the error occurs depending of the 3DS model I want to load..
quote:Original post by Sneftel
Erm, I''m pretty sure VC++ doesn''t have any bugs regarding assertions. They aren''t especially complex things, so they tend to either work or not.
Perhaps you could post your code?
Hm..let''s say, I think it''s strange I get an assertion error since I''m not even using any assertion functions in my code.
-Luctus
quote:Original post by Luctus
Hm..let''s say, I think it''s strange I get an assertion error since I''m not even using any assertion functions in my code.
This means that you''re passing bad arguments to a system function that has an assert in it to check. If you ignore that and compile in Release mode to get rid of the assert, it''s no longer going to check what you pass in, and your results are going to be undefined. Meaning that your program will probably crash what appears to be "randomly".
Fix the error, don''t ignore it.
It has to do with memory deallocation. When you compile your code in debug mode new/delete are handled differently than in release mode. A linked list of valid memory blocks is built up and released throughout your programs life time. If you call delete on an invalid pointer you get this assertion. This assertion can also happen in other circumstances too.
Make sure your variable "CurrentChunks" is pointing to a valid memory location before you try and delete it. It is your bug, not VCs...
Dire Wolf
www.digitalfiends.com
Make sure your variable "CurrentChunks" is pointing to a valid memory location before you try and delete it. It is your bug, not VCs...
Dire Wolf
www.digitalfiends.com
Hi!
I have again Memory problems :
The error occured when I did a delete CurrentChunck..
In fact using debug I found where exactly the error was:
Model3ds.pObject[Model3ds.numOfObjects - 1];
Model3ds.numOfObjects++;
//HERE NO PROBLEMS : CurrentChunk is not modified
//allocate some memory
*( &Model3ds.pObject + (Model3ds.numOfObjects-1)*sizeof(Object3DS) ) = new(Object3DS);
//CurrentChunk is not Modified
// Initialize the object and all it''s data members
memset(&(Model3ds.pObject[Model3ds.numOfObjects - 1]), 0, sizeof(Object3DS));
//HERE PROBLEM: CurrentChunck is modified
// Get the name of the object and store it
CurrentChunck->bytesRead += SearchString(Model3ds.pObject[Model3ds.numOfObjects - 1].strName);
Apparately the problem occurs when I set the memory to 0 with memset..
A friend who''s coding under DOS, has the same problem: Can someone help us?
Thanks
I have again Memory problems :
The error occured when I did a delete CurrentChunck..
In fact using debug I found where exactly the error was:
Model3ds.pObject[Model3ds.numOfObjects - 1];
Model3ds.numOfObjects++;
//HERE NO PROBLEMS : CurrentChunk is not modified
//allocate some memory
*( &Model3ds.pObject + (Model3ds.numOfObjects-1)*sizeof(Object3DS) ) = new(Object3DS);
//CurrentChunk is not Modified
// Initialize the object and all it''s data members
memset(&(Model3ds.pObject[Model3ds.numOfObjects - 1]), 0, sizeof(Object3DS));
//HERE PROBLEM: CurrentChunck is modified
// Get the name of the object and store it
CurrentChunck->bytesRead += SearchString(Model3ds.pObject[Model3ds.numOfObjects - 1].strName);
Apparately the problem occurs when I set the memory to 0 with memset..
A friend who''s coding under DOS, has the same problem: Can someone help us?
Thanks
What exactly does SearchString do? I''d assume it returns the length of the string but how does it do it?
Dire Wolf
www.digitalfiends.com
Dire Wolf
www.digitalfiends.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement