watch_for_free - (Debugging) Watches for free of a pointer
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
void watch_for_free(void *ptr);
In development code, this routine checks for an inadvertant free of the
pointer argument. The watch is terminated by using a NULL argument. If the
pointer is freed before that time, then you are prompted for an abort. To
state the obvious, the watch should be terminated before a non-inadvertant
free is called. The typical use is :
| allocation of "ptr"
code which is suspected of freeing ptr when it should not
free of "ptr"
In production code, watch_for_free() is defined as a NULL macro, so it
disapears. However, normally watch_for_free() is simply inserted for a run,
and then removed.
Unfortunately, only one pointer can be watched at present.
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.