I have been experimenting with Electric Fence recently, and I can't figure out how to use it with C ++ code.
Here is an example:
#include <cstdlib>
using namespace std;
int main()
{
int *a = new int(10);
delete a;
}
I compiled it with
g++ ./test.cpp -o test -lefence -L/home/bor/efence_x86_64/lib -lpthread
And I do not see the Electric Fence banner at the beginning and cannot find the EF characters in the executable (using the nm command).
But if I change a program like this:
#include <cstdlib>
using namespace std;
int main()
{
char *p = (char*)malloc(20);
free(p);
int *a = new int(10);
delete a;
}
all is well - appears EF. I know this solves the problem, I know :). I just want to understand why this did not work in the first place, because it new()should call malloc(), but it delete()calls free(), no?
, , - boost . malloc() free() . EF, EF , , EF . EF . ? , EF , libs ? - EF .