CMapStringToOb Problem

Guys I hope you can help me here.

I have a CMapStringToOb member within a parent class that refers to other instances of a particular class within the scope of the application.

Just before the application terminates, the parent class' destructor loops round the map and deletes the referred to instances of the particular class (they were new'd when they were created).

However, here lies the problem.  When deleting within the loop one class instance, I get this error message :

DAMAGE: after normal block (#2354) at 0x00D 46AEO.

I have checked and checked this class instance during the application scope and it doesn't seem to change in anyway.

Anyone know what the problem is.  I've really racked my brains over this one but can't come up with a solution.

Thanks in advance.
carlpaddickAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mandhjoCommented:
Can we see the code that allocates the objects and the code that deletes them?
0
GGRUNDYCommented:
If I got a message like that I would assume that one of the objects that I was freeing had written inadventantly over the heap. e.g. maybe the class contains a char[10] member and I had copied too much data into it. If it was always block #2354 I would
use _CrtSetBreakAlloc to see exactly which object is being corrupted. I might also use _CrtCheckMemory to binary search though my code until I found to point at which the corruption is occuring. When the object is being freed the horse has already bolted.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
carlpaddickAuthor Commented:
Thanks Grundy.

I also have a class derived from the  class in question .  I inadvertantly added an extra member variable to this derived class, and in the application made a cast and assignment which increased the size of the class in question.  The parent class' destructor obviously threw a wobbler when it came to deleting something that was larger than it created orginally.

Thanks for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.