 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
When
new cannot allocate the requested memory, it calls a
|
|
default
callback function from the standard library called
|
|
|
new_handler.
|
|
| • |
This
function throws an exception of type bad_alloc.
|
|
| • |
By
registering a callback function, our own can be called
|
|
|
instead
of new_handler.
|
|
| • |
This
can be done by calling the function set_new_handler.
|
|
| • |
This
function takes one argument: a pointer to a function
|
|
|
that
takes no arguments and returns void.
|
|
| • |
It
returns a pointer to the previous callback, which is
|
|
|
initially
the default (new_handler).
|
|