File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 17
17
18
18
class XRCORE_API xrMemory
19
19
{
20
+ // Additional 16 bytes of memory almost like in original xr_aligned_offset_malloc
21
+ // But for DEBUG we don't need this if we want to find memory problems
22
+ #ifdef DEBUG
23
+ constexpr size_t reserved = 0 ;
24
+ #else
25
+ constexpr size_t reserved = 16 ;
26
+ #endif
27
+
20
28
public:
21
29
xrMemory ();
22
30
void _initialize ();
@@ -27,9 +35,9 @@ class XRCORE_API xrMemory
27
35
public:
28
36
size_t mem_usage ();
29
37
void mem_compact ();
30
- inline void * mem_alloc (size_t size) { stat_calls++; return scalable_malloc ( size); };
31
- inline void * mem_realloc (void * ptr, size_t size) { stat_calls++; return scalable_realloc (ptr, size); };
32
- inline void mem_free (void * ptr) { stat_calls++; scalable_free (ptr); };
38
+ inline void * mem_alloc (size_t size) { stat_calls++; return scalable_malloc ( size + reserved ); };
39
+ inline void * mem_realloc (void * ptr, size_t size) { stat_calls++; return scalable_realloc (ptr, size + reserved ); };
40
+ inline void mem_free (void * ptr) { stat_calls++; scalable_free (ptr); };
33
41
};
34
42
35
43
extern XRCORE_API xrMemory Memory;
You can’t perform that action at this time.
0 commit comments