|
From: richa <ri...@te...> - 2008-02-04 10:17:10
|
Hi All, I have written the multithreaded server application, a thread will get spawn to process the client request. The thread will get terminated once processed the request. I am using g++ compiler for compiling my application of version libc-2.2.4-13 in linux 7.2 The code is compiled with "-g" option as well as with pthread and other relevant libraries. Load test result is the memory leak. I am using the valgrind-3.3.0 memcheck tool to analyze the memory leak, the option for using memcheck tool is: valgrind --tool=memcheck -v --trace-children=yes --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes --workaround-gcc296-bugs=yes <binary name with full path> 2> MemoryLeak.log & once I execute the command mentioned above, I will send the client request to the server and once the server processed the request, I am doing: pkill memcheck and Valgrind will dump the output into the MemoryLeak.log file. I am not able to identify the leak in my application files else I am getting the output as valgrind application file as: malloc (vg_replace_malloc.c:207). The memory leak output should indicate my application file name instead of valgrind application file name. Please help me in solving the problem. Thanks in advance, Richa |
|
From: Dan K. <da...@ke...> - 2008-02-04 11:47:11
|
On Feb 4, 2008 2:17 AM, richa <ri...@te...> wrote: > I have written the multithreaded server application, a thread will get spawn > to process the client request. > The thread will get terminated once processed the request. (FWIW, that's not very scalable; better to serve multiple requests per thread.) > I am not able to identify the leak in my application files else I am getting > the output as valgrind application file as: > > malloc (vg_replace_malloc.c:207). > > The memory leak output should indicate my application file name instead of > valgrind application file name. Can you show a little more context, say, ten lines of the log around that message? I ran into a problem valgrinding Wine where on many machines I didn't get full stack tracebacks, perhaps you're running into something similar. - Dan |
|
From: Paul F. <pa...@fr...> - 2008-02-04 13:29:39
|
Quoting richa <ri...@te...>: > Hi All, > > I have written the multithreaded server application, a thread will get spawn > to process the client request. > The thread will get terminated once processed the request. > I am using g++ compiler for compiling my application of version > libc-2.2.4-13 in linux 7.2 > The code is compiled with "-g" option as well as with pthread and other > relevant libraries. > Load test result is the memory leak. > > I am using the valgrind-3.3.0 memcheck tool to analyze the memory leak, the > option for using memcheck tool is: > > valgrind --tool=memcheck -v --trace-children=yes --num-callers=20 > --leak-check=yes --leak-resolution=high --show-reachable=yes > --workaround-gcc296-bugs=yes <binary name with full path> 2> MemoryLeak.log > & > > once I execute the command mentioned above, I will send the client request > to the server and once the server processed the request, I am doing: > pkill memcheck > and Valgrind will dump the output into the MemoryLeak.log file. > > I am not able to identify the leak in my application files else I am getting > the output as valgrind application file as: > malloc (vg_replace_malloc.c:207). > > The memory leak output should indicate my application file name instead of > valgrind application file name. Hi Valgrind replaces calls to glibc memory management functions with its own instrumented versions. So this is normal behaviour. It's the code where malloc is called that you should be looking at. You can use the --log-file option of valgrind instead of shell redirection. Take care with --trace-children, especially if your app spawns many children. A+ Paul |