void* GCHashtableAllocHandler_VMPI::alloc(size_t size, bool canFail) { void* p = VMPI_alloc(size); if (!p && !canFail) { // ran out of memory... GCHeap::GetGCHeap()->Abort(); } return p; }
void *SystemNew(size_t size, FixedMallocOpts opts) { void *space = VMPI_alloc(size); if (space == NULL) { if (opts & MMgc::kCanFail) return NULL; int attempt = 0; do { GCHeap::GetGCHeap()->SystemOOMEvent(size, attempt++); space = VMPI_alloc(size); } while (space == NULL); } #ifdef MMGC_MEMORY_PROFILER GCHeap* heap = GCHeap::GetGCHeap(); if (heap) heap->TrackSystemAlloc(space, size); #endif if (opts & MMgc::kZero) VMPI_memset(space, 0, size); return space; }
void* GCAllocObject::operator new[] (size_t size) { return VMPI_alloc(size); }