Re: Regarding loops and memory leak

"Ken A. Redergård" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

Thanks both for testing the example :-)

Out of old habit I've been running configure like this:
./configure --enable-warnings --with-defaults=debug --with-malloc=checked

I've tried without these arguments now, and the leak disappeared in the 
test_octstr example.

But the sqlbox code that runs the same kind of loop still leak memory 
without the debug params.  I guess I have some debugging left :-(

-Ken.

Benjamin Lee wrote:

>For what it's worth, 
>
>I tested (simply just by watching top output) the code below... and there
>doesn't appear to be a memory leak.  I used the latest CVS code and rebuilt
>the lib .a files too.
>
>
>[ben@xaos:~/cvs/remote/gateway]$ gcc -D_REENTRANT=1 -I. -Igw  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -DBROKEN_PTHREADS=1 -I/usr/include/libxml2 -I/usr/include/openssl -Wall -c  test_asdfsd.c
>test_asdfsd.c: In function `main':
>test_asdfsd.c:8: warning: unused variable `i'
>[Mon, 13 Sep 2004 14:24:39 +1000] Home Sweet Home
>[ben@xaos:~/cvs/remote/gateway]$ gcc -D_REENTRANT=1 -I. -Igw  -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -DBROKEN_PTHREADS=1 -I/usr/include/libxml2 -I/usr/include/openssl -Wall -lssl -lpthread -lxml2 -o teststs test_asdfsd.o libgw.a libgwlib.a
>[Mon, 13 Sep 2004 14:24:43 +1000] Home Sweet Home
>[ben@xaos:~/cvs/remote/gateway]$
>[Mon, 13 Sep 2004 14:24:44 +1000] Home Sweet Home
>[ben@xaos:~/cvs/remote/gateway]$ ./teststs
>
>
>
>
>On Monday, 2004-09-13 at 01:53:32 AM, "Ken A. Redergård" scribbled:
>  
>
>>Hi,
>>
>>Read your posting in the [email protected] list and have a simliar 
>>problem myself.
>>
>>I'm also running SuSE 9.1 and experience a memoryleak which I described 
>>in this posting:
>>http://www.kannel.org/mailman/private/devel/2004-August/020299.html
>>
>>As Stipe Tolj said it does not show up in valgrind, but the leak is 
>>present and increasing as long as the loop is beeing run.
>>
>>Could you try to run this piece of code and tell me if you also get a 
>>memoryleak ?
>>It could be that the while(run) semantics in your example are equal to 
>>the one in the leaking example below.
>>
>>/* test_octstr.c */
>>
>>#include <unistd.h>
>>#include "gwlib/gwlib.h"
>>
>>int main(void) {
>> Octstr *os;
>> int i;
>>
>> gwlib_init();
>>
>>while(1) {
>>   os = octstr_format("sadfasdfasdfas");
>>   octstr_append(os, octstr_imm("asdfasdfasdfasdf"));
>>   octstr_destroy(os);
>>   gwthread_sleep(1);
>> }
>>
>> /* we never get here */
>> return 0;
>>}
>>
>>With regards,
>>Ken A. Redergård
>>
>>
>>    
>>
>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.