Between delete and next command -- What happens? 
Author Message
 Between delete and next command -- What happens?

    I've created a library of objects that can empty itself.  My problem: it
only works for the first 60 times in debug build, 137 times in release
build.  What it loads each time is identical.

    It seems I'm having trouble with delete, but not with my deconstructor.
I've tracked the problem down to a call to delete a custom object.  I've
modified my code to include log file writing before and after the delete, as
well as when entering and exiting the object's deconstructor:

WriteToLog("About to delete\0");
delete pMyObject;
WriteToLog("Deleted object\0");

AND

MyObjectClass::~MyObjectClass()
{
    WriteToLog("\tEntered Deconstructor\0");
    // All deconstructor stuff here
    WriteToLog("\tExiting Deconstructor\0");

Quote:
}

The log shows that it gets ready to delete, enters the deconstructor and
exits it:

About to delete
    Entered Deconstructor
    Exiting Deconstructor

The problem seems to be that although the program reaches the end of the
deconstructor, it never makes it back to the line immediately following the
delete.  As mentioned, the first 60 times I empty the library it works and
the log appears as expected.  In fact this set of commands would occur
dozens of times every time I empty the library.  Only this 61st time does it
not come back from delete as expected.

How would you debug a problem like this?  My deconstructor seems to be
working, but delete isn't.  Does this make sense?  Where could I even start
looking for the source of the trouble?



Fri, 26 Sep 2003 01:21:21 GMT  
 Between delete and next command -- What happens?
Hello Scott,

Quote:
> It seems I'm having trouble with delete, but not with my deconstructor. it
> only works for the first 60 times in debug build, 137 times in release
> build.

You can check your program with NuMega's BoundsChecker and probably it will
help to resolve the problem
(http://www.numega.com/devcenter/bc.shtml).

Regards,
Vadim.



Fri, 26 Sep 2003 00:50:53 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Between delete and next command -- What happens?

2. Which error happened in deleting instance

3. Find / Find next command setting

4. SqlCommand.ExecuteNonQuery() and DELETE command Returns 0 Rows

5. How to delete a file by using c command

6. New and Delete Command

7. ASSERTion on delete? (delete [] bla bla)

8. how to delete a DELETED directory ?

9. Q: CRecordSet::Delete() doesn't really delete??

10. CRecordset::Delete does not delete my record!

11. delete[] instead of delete

12. delete and delete []

 

 
Powered by phpBB® Forum Software