mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-30 04:40:04 -04:00
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7069 e03df62e-2008-0410-955e-edbf42e46eb7
22 lines
578 B
C++
22 lines
578 B
C++
// Use the global heap for this process for all allocate/free operations.
|
|
#include "inspircd_win32wrapper.h"
|
|
#include <exception>
|
|
#include <new>
|
|
#include <new.h>
|
|
|
|
void * ::operator new(size_t iSize)
|
|
{
|
|
void* ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, iSize); // zero memory for unix compatibility
|
|
/* This is the correct behaviour according to C++ standards for out of memory,
|
|
* not returning null -- Brain*/
|
|
if (!ptr)
|
|
throw std::bad_alloc();
|
|
else
|
|
return ptr;
|
|
}
|
|
|
|
void ::operator delete(void * ptr)
|
|
{
|
|
HeapFree(GetProcessHeap(), 0, ptr);
|
|
}
|