Skip to main content
GameDev.net gamedev.net
🔒 Locked

weird assertion failure !!

Started by zaidgs Apr 27, 2004 at 5:46 AM 5 replies 250+ views
Original Post
zaidgs
zaidgs
i have tried to make a tutorial excercize on the subject of genetic algorithms. its not nessary to understand what genetic algorithms are to try solve my problem. i have some code that is called about 10 Million times, oddly it produces about 3-10 assertion failed per run !!! in this code there are few random paths, but according to my estimations (that i am almost sure of) it needs only about 3000 times to go through all path possibilities. (so i think if there is such an obvious leak, its should be reported more than just few times) also , these alternating paths have no pointer operations, so its unlikely there is some leak in one path but not in the other!! note: i have a C++ class, wrapped in a C++ __gc class, called by vb.net (2002). it says that: file: dbgheap.c line: 346 expression: _CrtCheckMemory() how can i debug this error ?!?! any suggestions ?!
flangazor
flangazor
It looks like a pass by value without a valid copy constructor had a destructor called when the cctor'd data went out of scope and deleted memory you were using.

FAQ Request: This comes up a lot and even if it's not the solution do zaidgs' problem, I think it would be good if there was a tutorial on this. If you are a mod and want me to write it, email me.

[edited by - flangazor on April 27, 2004 7:35:08 AM]
zaidgs
zaidgs
i dont have any copy contructors in the class i made,
also i have no class passed (either byref, or byval),
all arguments i have are int, long ... etc
flangazor
flangazor
Are you creating arrays on the heap?
zaidgs
zaidgs
yes, and i use
delete [] pointer;

...........
i tested my c++ class, (the normal class)
in a console exe application,
i used:
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
it works fine, with no leaks,
and no assertion fails!!!
still i cannot get it work correctly with garbage .net stuff!!!

seems i''m missing something !!!
flangazor
flangazor
I was leaning towards being concerned about deleting deleted data.

int* a = new int[10];
delete [] a;
delete [] a; // =-O
zaidgs
zaidgs
guess not!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.