Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
    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;
    }
Exemplo n.º 3
0
	void* GCAllocObject::operator new[] (size_t size)
	{
		return VMPI_alloc(size);
	}