acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
system_heap.h
1#pragma once
2
3
4#define ZEROED_ALLOC 1
5
6
7
8
9CLASS_DECL_ACME void * memory_allocate_no_track(memsize size);
10
11
12
13CLASS_DECL_ACME void * memory_allocate_debug(memsize nSize, ::i32 nBlockUse, const_char_pointer szFileName, ::i32 nLine);
14CLASS_DECL_ACME void * memory_reallocate_debug(void * p, memsize nSize, ::i32 nBlockUse, const_char_pointer szFileName, ::i32 nLine);
15CLASS_DECL_ACME void memory_free_debug(void * p, ::i32 iBlockType);
16CLASS_DECL_ACME memsize memory_size_debug(void* p, ::i32 iBlockType);
17
18
19
20
21
22
23#if MEMDLEAK
24
25
26CLASS_DECL_ACME ::i32 memdleak_enabled();
27CLASS_DECL_ACME void memdleak_enable(::i32 enable);
28CLASS_DECL_ACME ::i32 global_memdleak_enabled();
29CLASS_DECL_ACME void memdleak_init();
30CLASS_DECL_ACME void memdleak_term();
31
32
33#endif
34
35
36#if MEMDLEAK
37
38
39CLASS_DECL_ACME void set_last_block_file_name(const ::scoped_string & scopedstr);
40CLASS_DECL_ACME void memdleak_dump();
41
42
43#endif
44
45class CLASS_DECL_ACME system_heap :
46 virtual public ::particle
47{
48
49
50#if MEMDLEAK || defined(__MCRTDBG)
51
52
53 void * system_heap_alloc_debug(memsize size, ::i32 nBlockUse, const_char_pointer pszFile, ::i32 iLine);
54 void * system_heap_realloc_debug(void * p, memsize size, ::i32 nBlockUse, const_char_pointer pszFile, ::i32 iLine);
55
56
57#endif
58
59
60 void * system_heap_alloc_normal(memsize size);
61 void * system_heap_realloc_normal(void * pvoidOld, memsize size);
62//
63//
64//#if MEMDLEAK || defined(__MCRTDBG)
65//
66//
67//#define system_heap_alloc(s) system_heap_alloc_debug(s, 49, __FILE__, __LINE__)
68//#define system_heap_realloc(p, s) system_heap_realloc_debug(p, s, 49, __FILE__, __LINE__)
69//
70//
71//#else
72//
73//
74//#define system_heap_alloc(s) system_heap_alloc_normal(s)
75//#define system_heap_realloc(p, s) system_heap_realloc_normal(p, s)
76//
77//
78//#endif
79//
80
81 void system_heap_free(void * p);
82 memsize system_heap_alloc_size(void * p);
83
84
85};
86
87
89{
90
91
92 ::i32 m_iBlockUse;
93 ::i32 m_iEnabled;
94 const_char_pointer m_pszFileName;
95 void * m_stacka[64];
96 ::i32 m_iStack;
97 ::u32 m_uiLine;
98 memsize m_size;
99 struct memdleak_block * m_pnext;
100 struct memdleak_block * m_pprevious;
101
102};
103
104
105
Definition system_heap.h:47
Definition system_heap.h:89