summaryrefslogtreecommitdiff
path: root/3dc/MEM3DCPP.CPP
blob: 906b58954382666911c9e18599b0cce775d9d64b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "mem3dc.h"

#if DBGMALLOC

#if 1

// try and turn C++ new/delete tracking on such that
// we can do a malloc dump when the global objects
// with associated memory allocated is recored, the
// deallocation is recored, and then a malloc dump
// is done

// note that some global objects wont have their memory
// allocations/deallocations in the constructor/destructor
// tracked through record_malloc/record_free, but since
// global objects are deconstructed in the reverse order
// from construction, the deallocation type in the destructor
// will correspond to the allocation type in the constructor

int __cpp_new_recording = 0;

class DebugObject
{
public:
	DebugObject();
	~DebugObject();
};

DebugObject::DebugObject()
{
	__cpp_new_recording = 1;
}

DebugObject::~DebugObject()
{
	__cpp_new_recording = 0;
	DumpMallocInfo(DUMPTOFILE);
}

static DebugObject dbo;

#else

int __cpp_new_recording = 1;

#endif

#endif