remove global LV2 external GUI list, always call LV2 UI cleanup method when appropria...
[ardour2.git] / libs / pbd / dmalloc.cc
blob0e730946c8586283fba3b59cb3c6cf3868619bce
1 /*
2 * file that facilitates C++ program debugging.
4 * Copyright 1995 by Gray Watson
6 * This file is part of the dmalloc package.
8 * Permission to use, copy, modify, and distribute this software for any
9 * NON-COMMERCIAL purpose and without fee is hereby granted, provided
10 * that the above copyright notice and this permission notice appear
11 * in all copies, and that the name of Gray Watson not be used in
12 * advertising or publicity pertaining to distribution of the document
13 * or software without specific, written prior permission.
15 * Please see the PERMISSIONS file or contact the author for information
16 * about commercial licenses.
18 * Gray Watson makes no representations about the suitability of the
19 * software described herein for any purpose. It is provided "as is"
20 * without express or implied warranty.
22 * The author may be contacted via http://www.letters.com/~gray/
24 * $Id$
28 * This file is used to effectively redirect new to the more familiar
29 * malloc and delete to the more familiar free so they can be debugged
30 * with the debug malloc library.. They also give the known error
31 * behavior, too.
33 * Compile and link this in with the C++ program you want to debug.
35 * NOTE: I am not a C++ hacker so feedback in the form of other hints
36 * and ideas for C++ users would be much appreciated.
39 #ifdef DEBUG_MALLOC
41 extern "C" {
42 #include <stdlib.h>
43 #include <dmalloc.h>
44 #include "/usr/local/src/dmalloc-4.1.2/return.h"
48 * An overload function for the C++ new.
50 void *
51 operator new(size_t size)
53 char *file;
54 GET_RET_ADDR(file);
56 /* handle correct C++ semantics for an alloc of size 0 */
58 if (size == 0) size = 1;
60 return _malloc_leap(file, 0, size);
64 * An overload function for the C++ new[].
66 void *
67 operator new[](size_t size)
69 char *file;
70 GET_RET_ADDR(file);
72 /* handle correct C++ semantics for an alloc of size 0 */
74 if (size == 0) size = 1;
76 return _malloc_leap(file, 0, size);
80 * An overload function for the C++ delete.
82 void
83 operator delete(void *pnt)
85 char *file;
86 GET_RET_ADDR(file);
87 _free_leap(file, 0, pnt);
91 * An overload function for the C++ delete[]. Thanks to Jens Krinke
92 * <j.krinke@gmx.de>
94 void
95 operator delete[](void *pnt)
97 char *file;
98 GET_RET_ADDR(file);
99 _free_leap(file, 0, pnt);
102 #endif