hello users,

when i started playing around with axis2c i found
it very useful to have tcpmon the ability to
write to files and added the str_replace function
in tools\tcpmon\src\tcpmon.c

when i run longer testsessions with axis2 stuff,
tcpmon uses more and more memory over time.

i am not skilled in detecting leaks ...

using Visual Leak Detector 1.9f [http://dmoulding.googlepages.com/vld]

compiled tcpmon.c (svn 599617) with vld.h and
got following output, with leaks detected :

Call Stack:
tools\tcpmon\src\tcpmon.c (370): str_replace
tcpmon\src\tcpmon.c (240): on_new_entry_to_file
tcpmon\src\entry.c (480): tcpmon_entry_new_entry_funct
....    

ohoh mark, feeling guilty ?

i played around with str_replace and looked at line 370
char *str_return = (char *) malloc(size * sizeof(char));

k, this is what we need to free after returning,
str_replace is call-by-value with return.

mh ...

i didn't found a nice solution, just using a single
variable of 'convert' in 'on_new_entry_to_file'
for each time using the replace function :

convert1 = TCPMON_ENTRY_SENT_HEADERS(entry, env);
convert1 = str_replace(convert1, "; ", ";\n\t");
fprintf(file, "%s", convert1);
free(convert1);

convert2 = str_replace(formated_buffer, "; ", ";\n\t");
convert3 = str_replace(convert2, "><", ">\n<");
fprintf(file, "%s", convert3);
free(convert2);
free(convert3);

after new compiling, vld does not detect any leaks

so my questions are :
- does anyone have this kind of memory leak ?
- any nicer solutions ?

mfg derMark








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to