1#include "new"
2#include <stdlib.h>
3
4const std::nothrow_t std::nothrow = {};
5
6void* operator new(std::size_t size)
7{
8    void* p = malloc(size);
9    if (p == NULL) {
10        abort();
11    }
12    return p;
13}
14
15void* operator new[](std::size_t size)
16{
17    void* p = malloc(size);
18    if (p == NULL) {
19        abort();
20    }
21    return p;
22}
23
24void  operator delete(void* ptr)
25{
26    free(ptr);
27}
28
29void  operator delete[](void* ptr)
30{
31    free(ptr);
32}
33
34void* operator new(std::size_t size, const std::nothrow_t&)
35{
36    return malloc(size);
37}
38
39void* operator new[](std::size_t size, const std::nothrow_t&)
40{
41    return malloc(size);
42}
43
44void  operator delete(void* ptr, const std::nothrow_t&)
45{
46    free(ptr);
47}
48
49void  operator delete[](void* ptr, const std::nothrow_t&)
50{
51    free(ptr);
52}
53
54
55
56
57
58