libUTL++
gblnew.h File Reference

Overloaded new/delete operators. More...

#include <new>
#include <libutl/gblnew_macros.h>
Include dependency graph for gblnew.h:

Go to the source code of this file.

Namespaces

 utl
 UTL++ namespace.
 

Functions

void utl::memReportLeaks ()
 Report memory leaks.
 
void utl::memReportLeaks (bool includeUnknown)
 Report memory leaks. More...
 
void * operator new[] (size_t size)
 Overloaded operator new[]. More...
 
void operator delete[] (void *ptr) noexcept
 Overloaded operator delete[]. More...
 
void * operator new[] (size_t size, const char *file, uint_t line)
 Overloaded operator new[]. More...
 
void operator delete[] (void *ptr, const char *file, uint_t line) noexcept
 Overloaded operator delete[] (with file and line number info). More...
 
void * operator new (size_t size)
 Overloaded operator new. More...
 
void operator delete (void *ptr) noexcept
 Overloaded operator delete. More...
 
void * operator new (size_t size, const char *file, uint_t line)
 Overloaded operator new (with file and line number info). More...
 
void operator delete (void *ptr, const char *file, uint_t line) noexcept
 Overloaded operator delete (with file and line number info). More...
 

Detailed Description

Overloaded new/delete operators.

In DEBUG mode, the overloaded new and delete operators do extra checking to help identify common memory allocation mistakes for you (such as memory leaks). To have memory leaks reported, simply call memReportLeaks() just before your program exits.

Author
Adam McKee

Definition in file gblnew.h.

Function Documentation

◆ operator new[]() [1/2]

void* operator new[] ( size_t  size)

Overloaded operator new[].

Returns
address of allocated block
Parameters
sizenumber of bytes

◆ operator delete[]() [1/2]

void operator delete[] ( void *  ptr)
noexcept

Overloaded operator delete[].

Parameters
ptraddress of block to be freed

◆ operator new[]() [2/2]

void* operator new[] ( size_t  size,
const char *  file,
uint_t  line 
)

Overloaded operator new[].

Returns
address of allocated block
Parameters
sizeblock size in bytes
filename of file where block was allocated
lineline number within file where block was allocated

◆ operator delete[]() [2/2]

void operator delete[] ( void *  ptr,
const char *  file,
uint_t  line 
)
noexcept

Overloaded operator delete[] (with file and line number info).

Parameters
ptrblock address
filename of file where block was allocated
lineline number within file where block was allocated

◆ operator new() [1/2]

void* operator new ( size_t  size)

Overloaded operator new.

Returns
address of allocated block
Parameters
sizeblock size in bytes

◆ operator delete() [1/2]

void operator delete ( void *  ptr)
noexcept

Overloaded operator delete.

Parameters
ptrblock address

◆ operator new() [2/2]

void* operator new ( size_t  size,
const char *  file,
uint_t  line 
)

Overloaded operator new (with file and line number info).

Returns
address of allocated block
Parameters
sizeblock size in bytes
filename of file where block was allocated
lineline number within file where block was allocated

◆ operator delete() [2/2]

void operator delete ( void *  ptr,
const char *  file,
uint_t  line 
)
noexcept

Overloaded operator delete (with file and line number info).

Parameters
ptrblock address
filename of file where block was allocated
lineline number within file where block was allocated