gwnavruntime/kernel/SF_AllocInfo.h Source File

SF_AllocInfo.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 /**************************************************************************
8 
9 PublicHeader: Kernel
10 Filename : KY_AllocInfo.h
11 Content : Allocator Debugging Support
12 Created : October 1, 2008
13 Authors : Michael Antonov, Maxim Shemanarev
14 
15 **************************************************************************/
16 
17 #ifndef INC_KY_Kernel_AllocInfo_H
18 #define INC_KY_Kernel_AllocInfo_H
19 
21 
22 namespace Kaim {
23 
24 
25 // ***** Allocator Debugging Support
26 //
27 // Debugging support is optionally stored with every allocation.
28 // This consists of the following pieces of info:
29 // - StatId, used to identify and group allocation for statistic reporting.
30 // - Line + FileName, used to report the memory leaks when heap
31 // is released as a whole.
32 //------------------------------------------------------------------------
33 struct AllocInfo
34 {
35  // User-specified identifier for allocation.
36  unsigned StatId;
37 
38 #if defined(KY_BUILD_DEBUG)
39  // Track location in code where allocation took place
40  // so that it can be reported to debug leaks.
41  unsigned Line;
42  const char* pFileName;
43 
44  AllocInfo()
45  : StatId(Stat_Default_Mem), Line(0), pFileName("")
46  { }
47  AllocInfo(unsigned statId, const char* pfile, unsigned line)
48  : StatId(statId), Line(line), pFileName(pfile)
49  { }
50  AllocInfo(const AllocInfo& src)
51  : StatId(src.StatId), Line(src.Line), pFileName(src.pFileName)
52  { }
53 
54 #else
55 
56  AllocInfo() : StatId(Stat_Default_Mem)
57  { }
58  AllocInfo(unsigned statId, const char*, unsigned) : StatId(statId)
59  { }
60  AllocInfo(const AllocInfo& src) : StatId(src.StatId)
61  { }
62 
63 #endif
64 
65  // Note that we don't store the original Size here, since it is
66  // passed as a separate argument and we want to avoid such overhead.
67 };
68 
69 } // Scaleform
70 
71 #endif
Definition: gamekitcrowddispersion.h:20