091 public:
092 Object()
093 {
094 cout << "Object's contructor." << endl;
095 }
096
097 ~Object()
098 {
099 cout << "Object's destructor." << endl;
100 }
101
102 char data[1024];
103 };
104
105 #define NEW new(__FILE__, __LINE__)
106
107 int _tmain(int argc, _TCHAR* argv[])
108 {
109 ASSERT(CountOfAllocatedMem() == 0);
110 Object* pObj = new(buff) Object;
111
112 pObj->~Object();
113
114 pObj = NEW(Object);
115 ASSERT(CountOfAllocatedMem() == 1);
116
117 delete pObj;
118 ASSERT(CountOfAllocatedMem() == 0);
119
120 pObj = NEW Object;
121 ASSERT(CountOfAllocatedMem() == 1);
122 delete pObj;
123 ASSERT(CountOfAllocatedMem() == 0);
124
125 pObj = NEW Object;
126
127 char* p = new char[968];
128 ASSERT(CountOfAllocatedMem() == 2);
129
130 DumpUnAllocatedMem();
131 return 0;
132 }