Jump to content
  • Advertisement


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


Debug error

This topic is 5135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, i get The folowing error: debug error: DAMAGE :after Normal block (#44) at 0x00421ED0 i dont get the error when i remove the command a = b; in the folowing function:
template<class T>
void iSortStrategy<T>::swap(T& a,T& b)
	T temp = a;
	a = b;
	b = temp;
can someone help me???? thx in advance [edited by - freaker13 on May 27, 2004 2:54:58 PM]

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
There is nothing wrong with the code you posted. The problem is somewhere else. My guess is that when temp''s destructor is called, it deallocates memory "owned" by a. You need to overload the copy constructor and assignment operator to implement a proper copy operation. You can avoid the issue by swapping pointers rather than the objects themselves.

As a side note, rather than implement your own swap function, you could use the STL version (which is identical to yours).

Share this post

Link to post
Share on other sites
Do you get the same regardless of a debug or release build? You might want to check that you are not mixing debug and release builds of other libs that are being linked with your app. The error you are getting looks like some kind of heap corruption. This has caught me out in the past.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!