Skip to main content
gamedev.net
🔒 Locked

Untitled

Started by syedbabu Jul 2, 2004 at 3:26 AM 0 replies 900+ views
Original Post
syedbabu
syedbabu
I read the article titled "How To Find Memory Leaks " in flip code.com.Its really interesting.the article is pretty good.But i have a doubt in that. the new operator is overridden with 3 parameters.so i put the declaration in stdafx.h.wherei have to insert the defintion of the those function like( new,delete, AddTrack,RemoveTrack etc.,).i have to insert in stdafx.cpp or ? Similarly wherei have to insert the following code ( whether in the filw where we are using the new operator or in stdafx.h itself ) //------------------------ #ifdef _DEBUG #define DEBUG_NEW new(__FILE__, __LINE__) #else #define DEBUG_NEW new #endif #define new DEBUG_NEW //------------------------ if anyone can clarify it will be greatful. thanks babu
Paradigm Shifter
Paradigm Shifter
Don't put it into stdafx.h, otherwise you won't be able to define the real operator new without it being recursive-ised by the macro. Don't put any code into stafx.cpp either.

Put the #ifdef stuff in every .cpp file except in the one in which you define the 3 parameter new operator. Then add the cpp file with the new (and corresponding delete, and new[] and delete[]) to your project.

Untitled isn't a very good name for a topic, by the way.
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

Topic Locked

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

Sign in to reply to this topic.