How can I use the USE_PERFTOOLS_DEBUG ?

I see :

#ifdef USE_PERFTOOLS_DEBUG
fprintf(stderr, " -m|–mem-leaks | show leaks [perftools]\n");
fprintf(stderr, " -M|–mem-profile | record heap [perftools]\n");
#endif

in main.cc - How can I use these?

What this does is activating perftool's HeapChecker/HeapProfiler
during Bro's main loop (i.e., ignoring of all initialization/shutdown
code, which has known but uninteresting leaks). If you then set the
environment variable HEAPCHECK=local and run Bro with -m, it will
record leaks per
https://google-perftools.googlecode.com/svn/trunk/doc/heap_checker.html.
Similar for heap profiling.

Take a look at the tests in testing/btest/core/leaks, they use this.

Robin

Thanks.

Leak check net_run detected leaks of 96678 bytes in 912 objects
The 20 largest leaks:
Leak of 17920 bytes in 35 objects allocated from:
@ 72ba06
@ 72b48d
@ 72aabc
@ 72a00b
@ 7298f7
@ 728e47
@ 727916
@ 727df6
@ 7273a8
@ 724fa9
@ 69a5d5
@ 5f29e5
@ 7f250155dec5
@ 5d1bd8

What does @xxxxxx mean ? A function address ?

yeah, addr2line should be able to make them to something more readable.

Robin