It is working on my Fedora 24. You might need to upgrade your compiler or OS.
[bcall@homer ~]$ cat test.cc #include <stdlib.h> void dummy() { void *x = malloc(20); } int main() { dummy(); return 0; } [bcall@homer ~]$ g++ test.cc -fno-omit-frame-pointer -fsanitize=address [bcall@homer ~]$ ./a.out ================================================================= ==9344==ERROR: LeakSanitizer: detected memory leaks Direct leak of 20 byte(s) in 1 object(s) allocated from: #0 0x7f00500b3e60 in malloc (/lib64/libasan.so.3+0xc6e60) #1 0x400777 in dummy() (/home/bcall/a.out+0x400777) #2 0x400787 in main (/home/bcall/a.out+0x400787) #3 0x7f004f3a3730 in __libc_start_main (/lib64/libc.so.6+0x20730) SUMMARY: AddressSanitizer: 20 byte(s) leaked in 1 allocation(s). -Bryan > On Nov 10, 2016, at 2:22 PM, Vamsi Ambati <va...@neumob.com> wrote: > > Hi Sudheer, > > Thanks for the quick response. > I tried with your suggested code snippet but Address sanitizer doesn’t detect > the leak. > I even tried with gdb by introducing break point at __asan_report_error. > > > Vamsi > >> On Nov 10, 2016, at 1:58 PM, Sudheer Vinukonda <sudheervinuko...@yahoo.com >> <mailto:sudheervinuko...@yahoo.com>> wrote: >> >> Not sure if the *leak* in your test code below is detectable..since your >> program is exiting after allocating the memory (system should automatically >> reclaim the memory on process exit). >> >> You may try to modify it to something more explicit like the below - >> >>> #include <stdlib.h> >>> void dummy() { >>> char *c = (char*) malloc(20); >> c = (char*) malloc(100); >>> } >>> int main() { >>> dummy(); >>> while(1) {} >>> } >> >> >> >> On Nov 10, 2016, at 1:43 PM, Vamsi Ambati <va...@neumob.com >> <mailto:va...@neumob.com>> wrote: >> >>> >>> I am trying to resolve a memory leak issue with ATS 7.0 version. >>> We are using ATS from the CDN perspective and developed 3 plugins. >>> DevOps complains that traffic_server process gradually consumes lot of >>> memory and does release back which is a sign of memory leak. >>> I tried with Valgrind but it didn’t work because of LUA and one of our ATS >>> community member suggested to use Address Sanitizer. >>> I followed exactly the steps mentioned Debugging Traffic Server using >>> ASAN >>> <https://cwiki.apache.org/confluence/download/attachments/56066455/summit_asan.pptx?version=1&modificationDate=1429916307000&api=v2>. >>> >>> I have build the traffic server with CXXFLAGS=-fno-omit-frame-pointer >>> -fsanitize=address >>> Verified that traffic_server is build with ASAN library by 'ldd >>> bin/traffic_server’ >>> Restarted the traffic server with 'service nm-trafficserver restart'. >>> >>> I have adopted three approaches to catch the memory leak >>> >>> Approach 1: >>> Just running the traffic server(with -f option) and continuously sending >>> HTTP requests using wrk (from another machine) by attaching >>> to a gdb . >>> ' gdb $(pidof traffic_server)’ >>> break __asan_report_error. >>> >>> Issue: I didn’t hit this function from the memory leak perspective. >>> >>> Approach 2: >>> I have run the traffic server with PROXY_AUTO_EXIT and sending the http >>> requests >>> PROXY_AUTO_EXIT=30 ASAN_OPTIONS=detect_leaks=1:verbosity=2 >>> bin/traffic_server -f >>> >>> Issue: Tool didn’t complain any thing about the memory leak. >>> >>> >>> Approach 3: >>> I have created simple code explicitly introducing the memory leak >>> >>> #include <stdlib.h> >>> void dummy() { >>> malloc(20); >>> } >>> int main() { >>> dummy(); >>> return 0; >>> } >>> >>> Compiled with g++ -fsanitize=address add.cpp >>> Executed like ASAN_OPTIONS=detect_leaks=1 ./a.out >>> >>> Issue: Tool didn’t detect this memory leak. >>> >>> >>> Production System Configuration: >>> >>> 16Gb Ram with 8 cores VM. >>> gcc --version >>> gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 >>> >>> Did any one encounter this ASAN issue on Ubuntu 14.04 ? If so, how did >>> they resolve it ? >>> Any other suggestions how to narrow down the memory leak issue with ATS ? >>> >>> >>> >>> Regards >>> Vamsi >>> >>> PS: I am new to the community and new to Apache traffic server open source >>> module too. >>> >>> >>> >>> >