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 ()
26 void *operator new[](size_t size
) throw ()
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 int debug_new_counter_t::count
= 0; // initial value
60 #if defined(__CYGWIN__) || defined(INTERIX)
66 const char * __argv
[] __attribute__((weak
)) =
73 const char * debug_new_counter_t::progname
= __argv
[0];
75 debug_new_counter_t::debug_new_counter_t()
80 debug_new_counter_t::~debug_new_counter_t()
83 check_mem_leak(progname
);
87 void debug_new_counter_t::set_program_name(const char * pgn
)
92 #endif // MEMORY_DEBUG
This page took 0.045116 seconds and 6 git commands to generate.