1
+
2
+ Electric Fence - Red-Zone memory allocator.
3
+ Copyright (C) 1987-1999 Bruce Perens <
[email protected] >
4
+ Copyright (C) 2002 Hayati Ayguen <
[email protected] >, Procitec GmbH
5
+ License: GNU GPL (GNU General Public License, see COPYING-GPL) for all files except efencepp.h
6
+ License: GNU LGPL (GNU Lesser General Public License, see COPYING-GPL) for efencepp.h
7
+
8
+ --- GPL --
9
+
10
+ This program is free software; you can redistribute it and/or modify
11
+ it under the terms of the GNU General Public License as published by
12
+ the Free Software Foundation; either version 2 of the License, or
13
+ (at your option) any later version.
14
+
15
+ This program is distributed in the hope that it will be useful,
16
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
+ GNU General Public License for more details.
19
+
20
+ You should have received a copy of the GNU General Public License
21
+ along with this program; if not, write to the Free Software
22
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
+
24
+ --- LGPL --
25
+
26
+ This library is free software; you can redistribute it and/or
27
+ modify it under the terms of the GNU Lesser General Public
28
+ License as published by the Free Software Foundation; either
29
+ version 2.1 of the License, or (at your option) any later version.
30
+
31
+ This library is distributed in the hope that it will be useful,
32
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
33
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
34
+ Lesser General Public License for more details.
35
+
36
+ You should have received a copy of the GNU Lesser General Public
37
+ License along with this library; if not, write to the Free Software
38
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39
+
40
+ ---
41
+
42
+
43
+ This is Electric Fence 2.4
44
+
45
+ Added Port to Windows from Electric Fence 2.2.2.
46
+
47
+ Here some Compilation Notes for your Application in Debug Mode
48
+ for the Microsoft Visual C++ (v6) Compiler:
49
+
50
+ 1) don't use Program Database for "Edit and Continue":
51
+ Project-Options -> C++ -> General -> Debug-Info
52
+ 2) don't use the "multithreaded-dll" runtime library:
53
+ Project-Options -> C++ -> Code Generation -> Runtime library
54
+ 3) switch off incremental linking
55
+ Project-Options -> Linker -> General
56
+ 4) add following Linker option "/FORCE:MULTIPLE"
57
+ Project-Options -> Linker -> General
58
+
59
+ the labels may differ a bit cause i'm using the german version:
60
+
61
+ german options:
62
+ 1) Projekteinstellungen -> C++ -> Kategorie =Allgemein -> Debug-Info =Programmdatenbank
63
+ 2) Projekteinstellungen -> C++ -> Kategorie =Codegeneration -> Laufzeitbibliothek anpassen (Release/Debug),
64
+ nicht die DLL-Variante verwenden
65
+ 3) Projekteinstellungen -> Linker -> Kategorie =Allgemein - Inkrementelles Binden =Aus
66
+ 4) Projekteinstellungen -> Linker -> Projekt Optionen
67
+ "/FORCE:MULTIPLE" unten eingeben
68
+
69
+ now everything you have to do is to set a dependency to "efence" from your application.
70
+
71
+ Leak Detection:
72
+ ---------------
73
+ all memory allocation is protocoled from Electric Fence together with the filename/linenumber
74
+ of the caller. atexit() it is checked if each allocated memory block was freed; if not an error
75
+ occurs.
76
+ with EF_newFrame() and EF_delFrame you can create a new memory frame. embracing a smaller (than
77
+ the whole program) unit with these functions, you can check if the leak is in that smaller unit.
78
+ to disable leak detection add following preprocessor definition
79
+ EF_NO_LEAKDETECTION
80
+
81
+ C++ memory operators and leak detection:
82
+ ----------------------------------------
83
+ cause the c++ memory operators are syntactically different from normal functions there was the
84
+ need for a different kind of solution:
85
+ the following macros got introduced
86
+ 1) NEW_ELEM(TYPE)
87
+ 2) NEW_ARRAY(TYPE,COUNT)
88
+ 3) DEL_ELEM(PTR)
89
+ 4) DEL_ARRAY(PTR)
90
+ to use Electric Fence functionality you have to replace new/new[]/delete/delete[] by these
91
+ macros. these macros respect the EF_NO_LEAKDETECTION definition. because these macros need
92
+ the change of your source to take effect, you have to include <efencepp.h>. to avoid rechange
93
+ of your code these macros are expanded to "normal" new/delete when compiling release code.
94
+ this is also the reason why solely efencepp.h is put under LGPL.
95
+ to disable c++ new/delete/new[]/delete[] operator overload add following preprocessor definition
96
+ EF_NO_CPP
97
+
98
+
99
+ Hayati Ayguen
100
+
101
+
102
+ ---
103
+
1
104
This is Electric Fence 2.2
2
105
3
106
Electric Fence is a different kind of malloc() debugger. It uses the virtual
@@ -17,7 +120,8 @@ efence.3 .
17
120
There is a mailing list to support Electric Fence. You can subscribe to it
18
121
using the web form at http://lists.perens.com/mailman/listinfo/electric-fence.
19
122
20
- Thanks
21
-
22
- Bruce Perens
23
-
123
+ Thanks
124
+
125
+ Bruce Perens
126
+
127
+
0 commit comments