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 ******************************************************************************/
20 static void *dummy
= NULL
;
22 void *operator new(size_t size
) throw (std::bad_alloc
)
27 void *operator new[](size_t size
) throw (std::bad_alloc
)
29 if (size
== 0) return &dummy
;
30 else return Malloc(size
);
33 void operator delete(void *ptr
) throw()
38 void operator delete[](void *ptr
) throw()
40 if (ptr
!= (void*)&dummy
) Free(ptr
);
43 /**************************************************************************/
47 // overloads for memory debug
48 void* operator new(size_t size
, const char* file
, int line
)
50 return Malloc_dbg(file
, line
, size
);
53 void* operator new[](size_t size
, const char* file
, int line
)
55 if (size
== 0) return &dummy
;
56 else return Malloc_dbg(file
, line
, size
);
59 int debug_new_counter_t::count
= 0; // initial value
61 #if defined(__CYGWIN__) || defined(INTERIX)
67 const char * __argv
[] __attribute__((weak
)) =
74 const char * debug_new_counter_t::progname
= __argv
[0];
76 debug_new_counter_t::debug_new_counter_t()
81 debug_new_counter_t::~debug_new_counter_t()
84 check_mem_leak(progname
);
88 void debug_new_counter_t::set_program_name(const char * pgn
)
93 #endif // MEMORY_DEBUG
This page took 0.092221 seconds and 5 git commands to generate.