SpiecsEngine
 
Loading...
Searching...
No Matches

◆ SystemAlloc()

static void * Spices::SystemAlloc ( size_t kpage)
inlinestatic

Alloc memory from system.

Parameters
[in]kpagepages.
Returns
Returns allocated memory pointer.

Definition at line 107 of file MemoryPool.h.

108 {
109#ifdef _WIN32
110
114 void* ptr = VirtualAlloc(0, kpage << MemoryPool::PAGE_SHIFT, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
115#else
116
117#endif
118
119 if (ptr == nullptr)
120 {
121 SPICES_CORE_ERROR("Memory alloc failed.")
122 }
123
124 SPICES_PROFILE_ALLOC_N(ptr, kpage << MemoryPool::PAGE_SHIFT, memoryPoolNames[1]);
125
126 return ptr;
127 }
#define SPICES_PROFILE_ALLOC_N(ptr, size, name)