#include <iostream>

#include <cstdlib>
#include <new>

void* operator new(std::size_t size, const char* file, int line)
{  
	std::clog << file << ": " << line << std::endl;
	void * t_pNewHeapObject = std::malloc( size );
  
  if ( t_pNewHeapObject )
	{
    // Meine implementierung
    return t_pNewHeapObject;
	}
  throw std::bad_alloc{};
}
//----------------------------------------------------------------------------
void* operator new [](std::size_t size, const char* file, int line)
{  
	void * t_pNewHeapObject = std::malloc( size );
  
  if ( t_pNewHeapObject )
	{
    // Meine implementierung
    return t_pNewHeapObject;
	}
  throw std::bad_alloc{};
}
//----------------------------------------------------------------------------
void operator delete(void* ptr) noexcept
{
    // Meine implementierung
    std::free(ptr);
    ptr= nullptr;
}
//----------------------------------------------------------------------------
#define new new(__FILE__, __LINE__)
//----------------------------------------------------------------------------

//using namespace std;

int main() {
    int* p = new int;

    delete p;
	return 0;
}
