Electric Fence(efence)は、malloc()のメモリバッファでオーバーラン(またはアンダーラン)を正確に起こす命令であなたのプログラムを停止します。。続いてGDBはバグを起こすソースコード行を表示します。仮想メモリのハードウェアを使用して各バッファの境界にレッドゾーンを作成し、それにタッチし、あなたのプログラムが停止します。長年にわたってあなたを悩ませている、これらの以前は捕捉不可能だった全てのオーバーランのバグをキャッチします。
The main focus of this release is better
portability. A standardized strerror() is now
used. An error which occurred when
EF_NO_LEAKDETECTION was defined was fixed.
Allocations from standard libraries are marked
before ef_init() is called to allow special
treatment in leak-checking. The default in eftest
was changed to use two signals at once: SIGSEGV
and SIGBUS. Alignments bigger than page size are
now allowed for memalign(). The EF_EXPLICIT_INIT
preprocessor flag was added to work around buggy
environments. Environment leaks are no longer
reported.
Bugs in page management under Windows where virtual address space was never released was fixed, though this fix avoids memory pooling (under Windows). An ExitOnFail parameter was added to Page_Create(). A warning is now displayed when an allocation failed and ExitOnFail is off. _eff_allocate() was extended for this.
Bugfixes were made in memory management. New macros were provided for new and delete. Functions for doing extra checks were added for strdup(), memcpy(), strcpy(), strncpy(), strcat(), and strncat(). A new EF_SHOW_ALLOC environment switch was included.
This release reworks and revises all internal functions. It
adds an EF_OLD_NEW_MACRO preprocessor flag to keep
compatibility to old NEW_ELEM() / NEW_ARRAY() macros.
Freeing already freed memory is now detected. It stores
__FILE__ and __LINE__ of free() to be able to print the
position of first free. This version fixes a bug that occurred
when calling eftest with a higher number e.g. 10000. There
were bugfixes to memalign() which was not exported.
Macros and functions are now also defined for valloc().
EF_NO_GLOBAL_MALLOC_FREEプリプロセッサフラグバグの環境を回避するために追加されました。これはmalloc(無料)、()、realloc()をし、calloc()からefenceライブラリのグローバルな名前空間に配置され、これefence.hを含めるためのファイルのみefence malloc関数の呼び出しができなくなります()置換機能します。このフラグは、どこにリンク順序を制御することはできません便利ですが、たとえば、メモリのライブラリからefence使用していない割り当てられているのためには無料()efenceを使用してから呼び出されます。この問題は、使用している。dllライブラリmsvcrt.dllは、そのmalloc関数に対するリンク/ MS Windowsの下、無料です。
タグ:
Minor feature enhancements
A EF_NO_GLOBAL_MALLOC_FREE preprocessor flag was added to work around buggy environments. This prevents malloc(), free(), realloc(), and calloc() from being put into the global namespace of the efence library, thus only files which include efence.h will call the efence malloc() replacement functions. This flag is also helpful where the linking order cannot be controlled, for example when memory is allocated from a library not using efence, but free() is called from using efence. This is a problem when using .dll libraries linked against msvcrt.dll and its malloc/free under MS Windows.