Re: Memory leak with curl_multi_socket_action
Date: Sun, 24 May 2020 22:17:58 +0100
On Sun, May 24, 2020 at 9:56 PM Patrick Schlangen <patrick_at_schlangen.me>
wrote:
> Am 24.05.2020 um 21:56 schrieb James Read via curl-library <
> curl-library_at_cool.haxx.se>:
> > ...
> > On closer inspection my valgrind output has the following lines:
> >
> > --69689-- Reading syms from /usr/lib/x86_64-linux-gnu/libcurl.so.4.6.0
> > --69689-- object doesn't have a symbol table
> >
> > So something is definitely wrong here.
>
> After building curl with debug information, did you also run ‚make
> install‘ to install the newly built library and link your application
> against it? It looks like you’re still linking against the system-provided,
> non-debug version.
>
>
Yes I did that. With some link magic I managed to get this working. Here is
some example output from valgrind.
==78076== 278,944 bytes in 379 blocks are possibly lost in loss record 77
of 83
==78076== at 0x483DD99: calloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==78076== by 0x48BBEE0: curl_dbg_calloc (memdebug.c:205)
==78076== by 0x490A1D0: Curl_ssl_initsessions (vtls.c:608)
==78076== by 0x48F4BAF: Curl_pretransfer (transfer.c:1455)
==78076== by 0x48C6048: multi_runsingle (multi.c:1619)
==78076== by 0x48C8841: multi_socket (multi.c:2833)
==78076== by 0x48C9053: curl_multi_socket_action (multi.c:2956)
==78076== by 0x10C6A7: event_cb (crawler.c:188)
==78076== by 0x10D7D9: crawler_init (crawler.c:556)
==78076== by 0x4A34608: start_thread (pthread_create.c:477)
==78076== by 0x4B95102: clone (clone.S:95)
==78076==
==78076== 381,136 bytes in 166 blocks are possibly lost in loss record 78
of 83
==78076== at 0x483DD99: calloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==78076== by 0x48BBEE0: curl_dbg_calloc (memdebug.c:205)
==78076== by 0x489E601: allocate_conn (url.c:1562)
==78076== by 0x48A28CA: create_conn (url.c:3378)
==78076== by 0x48A3A37: Curl_connect (url.c:3893)
==78076== by 0x48C6135: multi_runsingle (multi.c:1643)
==78076== by 0x48C8841: multi_socket (multi.c:2833)
==78076== by 0x48C9053: curl_multi_socket_action (multi.c:2956)
==78076== by 0x10C7D5: timer_cb (crawler.c:226)
==78076== by 0x10D780: crawler_init (crawler.c:554)
==78076== by 0x4A34608: start_thread (pthread_create.c:477)
==78076== by 0x4B95102: clone (clone.S:95)
==78076==
==78076== 962,024 bytes in 419 blocks are possibly lost in loss record 79
of 83
==78076== at 0x483DD99: calloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==78076== by 0x48BBEE0: curl_dbg_calloc (memdebug.c:205)
==78076== by 0x489E601: allocate_conn (url.c:1562)
==78076== by 0x48A28CA: create_conn (url.c:3378)
==78076== by 0x48A3A37: Curl_connect (url.c:3893)
==78076== by 0x48C6135: multi_runsingle (multi.c:1643)
==78076== by 0x48C8841: multi_socket (multi.c:2833)
==78076== by 0x48C9053: curl_multi_socket_action (multi.c:2956)
==78076== by 0x10C6A7: event_cb (crawler.c:188)
==78076== by 0x10D7D9: crawler_init (crawler.c:556)
==78076== by 0x4A34608: start_thread (pthread_create.c:477)
==78076== by 0x4B95102: clone (clone.S:95)
==78076==
==78076== 2,304,320 bytes in 379 blocks are possibly lost in loss record 80
of 83
==78076== at 0x483DD99: calloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==78076== by 0x48BBEE0: curl_dbg_calloc (memdebug.c:205)
==78076== by 0x489C739: Curl_open (url.c:588)
==78076== by 0x488DCF4: curl_easy_init (easy.c:301)
==78076== by 0x10CB52: new_conn (crawler.c:307)
==78076== by 0x10D676: crawler_init (crawler.c:533)
==78076== by 0x4A34608: start_thread (pthread_create.c:477)
==78076== by 0x4B95102: clone (clone.S:95)
==78076==
==78076== 3,548,493 bytes in 220 blocks are possibly lost in loss record 81
of 83
==78076== at 0x483B723: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==78076== by 0x483E017: realloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==78076== by 0x10CA22: write_cb (crawler.c:277)
==78076== by 0x48D707B: chop_write (sendf.c:606)
==78076== by 0x48D72CE: Curl_client_write (sendf.c:690)
==78076== by 0x48B3DD5: Curl_httpchunk_read (http_chunks.c:201)
==78076== by 0x48F3723: readwrite_data (transfer.c:794)
==78076== by 0x48F451B: Curl_readwrite (transfer.c:1248)
==78076== by 0x48C723F: multi_runsingle (multi.c:2095)
==78076== by 0x48C8841: multi_socket (multi.c:2833)
==78076== by 0x48C9053: curl_multi_socket_action (multi.c:2956)
==78076== by 0x10C6A7: event_cb (crawler.c:188)
==78076==
==78076== 4,078,303 bytes in 155 blocks are possibly lost in loss record 82
of 83
==78076== at 0x483DFAF: realloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==78076== by 0x10CA22: write_cb (crawler.c:277)
==78076== by 0x48D707B: chop_write (sendf.c:606)
==78076== by 0x48D72CE: Curl_client_write (sendf.c:690)
==78076== by 0x48B3DD5: Curl_httpchunk_read (http_chunks.c:201)
==78076== by 0x48F3723: readwrite_data (transfer.c:794)
==78076== by 0x48F451B: Curl_readwrite (transfer.c:1248)
==78076== by 0x48C723F: multi_runsingle (multi.c:2095)
==78076== by 0x48C8841: multi_socket (multi.c:2833)
==78076== by 0x48C9053: curl_multi_socket_action (multi.c:2956)
==78076== by 0x10C6A7: event_cb (crawler.c:188)
==78076== by 0x10D7D9: crawler_init (crawler.c:556)
==78076==
==78076== 6,215,979 bytes in 379 blocks are possibly lost in loss record 83
of 83
==78076== at 0x483B7F3: malloc (in
/usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==78076== by 0x48BBDB8: curl_dbg_malloc (memdebug.c:174)
==78076== by 0x489C7F1: Curl_open (url.c:606)
==78076== by 0x488DCF4: curl_easy_init (easy.c:301)
==78076== by 0x10CB52: new_conn (crawler.c:307)
==78076== by 0x10D676: crawler_init (crawler.c:533)
==78076== by 0x4A34608: start_thread (pthread_create.c:477)
==78076== by 0x4B95102: clone (clone.S:95)
Sorry for the overload. Quite a few memory leaks there. Any help would be
appreciated.
James Read
> Best,
>
> Patrick
>
>
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-05-24