1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
11 * Szabo, Janos Zoltan – initial implementation
13 ******************************************************************************/
19 static void *dummy
= NULL
;
21 void *operator new(size_t size
) throw (std::bad_alloc
)
26 void *operator new[](size_t size
) throw (std::bad_alloc
)
28 if (size
== 0) return &dummy
;
29 else return Malloc(size
);
32 void operator delete(void *ptr
) throw()
37 void operator delete[](void *ptr
) throw()
39 if (ptr
!= (void*)&dummy
) Free(ptr
);
42 /**************************************************************************/
46 // overloads for memory debug
47 void* operator new(size_t size
, const char* file
, int line
)
49 return Malloc_dbg(file
, line
, size
);
52 void* operator new[](size_t size
, const char* file
, int line
)
54 if (size
== 0) return &dummy
;
55 else return Malloc_dbg(file
, line
, size
);
58 void* operator new(size_t size
, const std::nothrow_t
&, const char* file
, int line
)
60 return Malloc_dbg(file
, line
, size
);
63 void* operator new[](size_t size
, const std::nothrow_t
&, const char* file
, int line
)
65 if (size
== 0) return &dummy
;
66 else return Malloc_dbg(file
, line
, size
);
69 int debug_new_counter_t::count
= 0; // initial value
71 #if defined(__CYGWIN__) || defined(INTERIX)
77 const char * __argv
[] __attribute__((weak
)) =
84 const char * debug_new_counter_t::progname
= __argv
[0];
86 debug_new_counter_t::debug_new_counter_t()
91 debug_new_counter_t::~debug_new_counter_t()
94 check_mem_leak(progname
);
98 void debug_new_counter_t::set_program_name(const char * pgn
)
103 #endif // MEMORY_DEBUG
This page took 0.03415 seconds and 5 git commands to generate.