示例#1
0
    void SystemDelete(void *p)
    {
#ifdef MMGC_MEMORY_PROFILER
        if (p) {
            // heap can be NULL during OOM shutdown
            GCHeap* heap = GCHeap::GetGCHeap();
            if (heap)
                heap->TrackSystemFree(p);
        }
#endif
        VMPI_free(p);
    }
示例#2
0
static int setenv16_with_putenv16(const wchar *name, const wchar *value)
{
    if(NULL != VMPI_strchr16(name, L'='))
    {
        errno = EINVAL;
        return -1;
    }
    else
    {
        size_t  nameLen     =   VMPI_strlen16(name);
        size_t  valueLen    =   VMPI_strlen16(value);
        size_t  required    =   1 + nameLen + 1 + valueLen;
        wchar   buffer_[101];
        wchar   *buffer     =   (ARRAY_SIZE(buffer_) < required)
                                    ? (wchar*)malloc(required * sizeof(wchar))
                                    : &buffer_[0];

        if(NULL == buffer)
        {
            errno = ENOMEM;
            return -1;
        }
        else
        {
            int r;
            (void)VMPI_strncpy16(&buffer[0], name, nameLen);
            buffer[nameLen] = L'=';
            buffer[nameLen + 1] = '\0';
            (void)VMPI_strncpy16(&buffer[nameLen + 1], value, valueLen);
            buffer[nameLen + 1 + valueLen] = '\0';

            r = _wputenv(&buffer[0]);

            if(buffer != &buffer_[0])
            {
                VMPI_free(buffer);
            }

            return r;
        }
    }
}
示例#3
0
 void GCHashtableAllocHandler_VMPI::free(void* ptr)
 {
     VMPI_free(ptr);
 }
示例#4
0
	void GCAllocObject::operator delete [] (void *ptr)
	{
		VMPI_free(ptr);
	}