All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SystemAllocator.h
1 #pragma once
2 
3 #include "Types.h"
4 
5 #if defined(EEGEO_IOS) || defined(EEGEO_OSX)
6 #include <malloc/malloc.h>
7 #endif
8 
9 namespace Eegeo
10 {
11  // doesn't really have any business being a class, just trying to divvy stuff up atm
13  {
14  public:
15 
16  static void Init();
17 
18  static void* Malloc(size_t size);
19  static void* Realloc(void* ptr, size_t size);
20  static void Free(void* ptr);
21  static void FreeDefiniteSize(void *ptr, size_t size);
22  static void* Calloc(size_t num_items, size_t size);
23  static void* MemAlign(size_t alignment, size_t size);
24 
25  static int GetDefaultAlignment();
26 
27 #if defined(EEGEO_IOS) || defined(EEGEO_OSX)
28  static void* Valloc(size_t size);
29  static size_t Size(const void *ptr);
30 #endif
31 
32  private:
33 
34 #if defined(EEGEO_IOS) || defined(EEGEO_OSX)
35  static malloc_zone_t* ms_systemImplementation;
36 #endif
37 
38  static const int m_defaultAlignment;
39  };
40 
41 };