
Electric Fence - Red-Zone memory allocator.
Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com>
Copyright (C) 2002-2005 Hayati Ayguen <h_ayguen@web.de>, Procitec GmbH
License: GNU GPL (GNU General Public License, see COPYING-GPL) for all files except efencepp.h
License: GNU LGPL (GNU Lesser General Public License, see COPYING-GPL) for efencepp.h

--- GPL --

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

--- LGPL --

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

---


This is Electric Fence 2.4

Added Port to Windows from Electric Fence 2.2.2.


SubDirectories:
---------------
win32-vide/*        project files for VIDE 1.24 (see http://www.objectcentral.com)
                    using the Borland C++ Builder 5.5 compiler (FreeCommandLineTools,
                    see http://www.borland.com)
win32-devcpp/*      project files for Dev-C++ 4.9.6 (see http://www.bloodshed.net)
                    using the gcc compiler (see http://gcc.gnu.org)
win32-msvc/*        projects files for Microsoft Visual C++ 6.0 IDE/compiler
                    (see http://www.microsoft.com)
debian/*            don't know; maybe some files for the Debian Linux distribution?!

Projects:
---------
efencelib           Electric Fence library. this library should be linked with YOUR program
eftest              first small test program
tstheap             second small test program
File:
------
COPYING-*           License files; reade carefully!
README              this text file
CHANGES             text file listing done CHANGES

efence.h		belongs to efencelib
                    this header file should be included from within YOUR C source
efencepp.h          belongs to efencelib
                    this header file should be included from within YOUR C++ source
efenceint.h         belongs to efencelib
                    library internal header file
efence.c            belongs to efencelib
                    contains malloc/free/.. functions
efencepp.cpp        belongs to efencelib
                    contains C++ new/delete/.. functions redirecting them
                      to ANSI C malloc/free
page.c              belongs to efencelib
                    library internal source file: contains paging functions
print.c             belongs to efencelib
                    library internal source file: contains printing/aborting functions
eftest.c            belongs to eftest
                    small test program; checks wether efencelib's paging does its job
                    should work without any errors
tstheap.c           belongs to tstheap
                    small test program; checks wether efencelib's heap does its job
                    should report many memory leaks after execution.
Makefile            Makefile for UNIX/Linux/..
efence.3            source for UNIX man page
ef.sh               don't know; some script for UNIX/Linux



Here some Compilation Notes for your Application in Debug Mode
for the Microsoft Visual C++ (v6) Compiler:

1) don't use Program Database for "Edit and Continue":
   Project-Options -> C++ -> General -> Debug-Info
2) don't use the "multithreaded-dll" runtime library:
   Project-Options -> C++ -> Code Generation -> Runtime library
3) switch off incremental linking
   Project-Options -> Linker -> General
4) switch off precompiled headers:
   Project-Options -> C++ -> Precompiled Headers
5) add following Linker option "/FORCE:MULTIPLE"
   Project-Options -> Linker -> General

the labels may differ a bit cause i'm using the german version:

options in german language:
1) Projekteinstellungen -> C++ -> Kategorie =Allgemein -> Debug-Info =Programmdatenbank
2) Projekteinstellungen -> C++ -> Kategorie =Codegeneration -> Laufzeitbibliothek anpassen (Release/Debug),
				  nicht die DLL-Variante verwenden
3) Projekteinstellungen -> Linker -> Kategorie =Allgemein - Inkrementelles Binden =Aus
4) Projekteinstellungen -> Linker -> Projekt Optionen
                  "/FORCE:MULTIPLE" unten eingeben

now everything you have to do is to set a dependency to "efence" from your application.

Leak Detection:
---------------
all memory allocation is protocoled from Electric Fence together with the filename/linenumber
of the caller. atexit() it is checked if each allocated memory block was freed; if not an error
occurs.
with EF_newFrame() and EF_delFrame you can create a new memory frame. embracing a smaller (than
the whole program) unit with these functions, you can check if the leak is in that smaller unit.
to disable leak detection add following preprocessor definition
EF_NO_LEAKDETECTION

C++ memory operators and leak detection:
----------------------------------------
Just include <efencepp.h> and recompile. There is a "new" macro which gives the filename and
line number of the source code to Electric Fence. The rest should behave as usual - but for
new all the overloaded new/delete functions do not behave fully C++ conform. Leak detection
and memory protection is done automatically as for malloc()/free().
to disable c++ new/delete/new[]/delete[] operator overload add following preprocessor definition
EF_NO_CPP_SUPPORT to the Makefile.


	Hayati Ayguen
	h_ayguen@web.de

---

This is Electric Fence 2.2

Electric Fence is a different kind of malloc() debugger. It uses the virtual
memory hardware of your system to detect when software overruns the boundaries
of a malloc() buffer. It will also detect any accesses of memory that has
been released by free(). Because it uses the VM hardware for detection,
Electric Fence stops your program on the first instruction that causes
a bounds violation. It's then trivial to use a debugger to display the
offending statement.

This version should run on all systems that support POSIX mmap() and
mprotect(). This includes Linux, Unix, and I think even BeOS.

Complete information on the use of Electric Fence is in the manual page
efence.3 .

There is a mailing list to support Electric Fence. You can subscribe to it
using the web form at http://lists.perens.com/mailman/listinfo/electric-fence.

	Thanks

	Bruce Perens
	bruce@perens.com

