MS VC++ Problem (Debug/Release)
Hi all!
I''ve a problem with MS Visual C++. If I compile my program with Debug-config everything works fine. But if I compile it with Release-config some error occur. I think I made some mistakes at dynamic memory management. But I don''t know where!
I''m using following code for allocating and deleting arrays:
float* test;
test = new float[anzahl];
delete[] test;
This is right, isn''t it?
I''m deleting every memory I allocte after using it.
I''m really confused about the face that if I''m calling a void in a loop the void sometimes works fine and sometimes does mistakes. But this only happens if I compile my program with Release-config.
What''s very strange too is that if I''m compiling with MS VS 6.0 no windows-error message appears but if I''m compiling with VS.NET an error message with the text "Heap-integry is incorrect" (or something like that).
Any ideas??
Thanks a lot!
Corrail
corrail@gmx.at
ICQ#59184081
--------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened...
You're definitelely allocating and deallocating memory correctly.
But the crash may be caused by some garbage pointer somewhere. It's happened to me before, but I never bothered to fix it
, I was giving up on that prject anyway...
Btw, I didn't try anything in vs.net... Only MSVC++ 6.0
[edited by - James Trotter on April 1, 2003 11:14:41 AM]
But the crash may be caused by some garbage pointer somewhere. It's happened to me before, but I never bothered to fix it

Btw, I didn't try anything in vs.net... Only MSVC++ 6.0
[edited by - James Trotter on April 1, 2003 11:14:41 AM]
It does look like a corrupt pointer or you are accessing outside the bounds of an array.
I''m not totally sure what you mean by this, could you explain it a bit more (if you feel it is relevant).
quote:
... I''m calling a void in a loop the void sometimes ...
I''m not totally sure what you mean by this, could you explain it a bit more (if you feel it is relevant).
Hi guyz!
I''ve found the error!!
I''ve done this before:
char* _chrINIFileName;
int SetFileName(char* _chrIn)
{
_chrINIFileName = new char[strlen(_chrIn)];
sprintf(_chrINIFileName, "%s", _chrIn);
return -32768;
}
instead of allocating (strlen(_chrIn)+1)!!!
But thanks a lot for your help!!
Corrail
corrail@gmx.at
ICQ#59184081
I''ve found the error!!
I''ve done this before:
char* _chrINIFileName;
int SetFileName(char* _chrIn)
{
_chrINIFileName = new char[strlen(_chrIn)];
sprintf(_chrINIFileName, "%s", _chrIn);
return -32768;
}
instead of allocating (strlen(_chrIn)+1)!!!
But thanks a lot for your help!!
Corrail
corrail@gmx.at
ICQ#59184081
--------------------------------------------------------There is a theory which states that if ever anybody discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.There is another theory which states that this has already happened...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement