Archived

This topic is now archived and is closed to further replies.

Dwiel

new & delete

Recommended Posts

Hi I have been having a horible time debugging a problem w/ new & delete. I have a hierchary like this: BaseClass / \ / \ objects templates / | \ / | \ a b c d e f a - new array of chars b - new array of ints c - pointer to an element in templates d,e,f - new array of chars Objects - new array of type ZFLObject Templates - new array of type ZFLTemplate ZFLObject, ZFLTemplate - class in ~BaseClass I try to delete objects and templates. templates will delete, objects doesn''t. things I have tried that didn''t change anything: delete in different order delete a,b before objects delete a,b,c before objects delete d,e,f before templates I have gotten rid of all free functions. if I place a break point on the line delete [] objects; and the data is all valid. (I can view it all w/out any ''error: expression can''t be evaluated'' errors in the variables view window) I have tried to say everything I tried, so people might have a better clue as to what is going on. If anybody has ever had any problems similar to mine, could please tell me what the problem was and how you fixed it. By the way the error message it gives me is: "DAMAGE: after normale block #87 0xhexcode" Tazzel3d ~ Zach

Share this post


Link to post
Share on other sites
Your error indicates that you have written past the boundary that is acceptable to write to. (Damage after Normal block indicates that you have altered the memory following a block of memory allocated for normal use.) For instance, if you had an array of 10 chars, writing to myArray[10] could cause this problem. Or, treating a Base class like a Derived class when it is actually a Base class could do this too, although it''s pretty hard to make that mistake.

Share this post


Link to post
Share on other sites