Kon,
I saw your memleak commit an i am testing it already.
However i am not sure though, there might be some other memleaks when calling pool_active which is happening quite often. I am attaching valgrind output just in case
The other stuff seemed not to be freed on cgminer exit which is not an issue:) Or i think so..
10X
==8359== HEAP SUMMARY:
==8359== in use at exit: 908,508 bytes in 4,143 blocks
==8359== total heap usage: 31,624 allocs, 27,481 frees, 41,232,886 bytes allocated
==8359==
==8359== 10 bytes in 2 blocks are definitely lost in loss record 24 of 212
==8359== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x5C83D71: strdup (strdup.c:43)
==8359== by 0x41F7F0: extract_sockaddr (util.c:871)
==8359== by 0x404DB3: detect_stratum (cgminer.c:558)
==8359== by 0x404EA0: set_url (cgminer.c:582)
==8359== by 0x433E98: parse_one (parse.c:110)
==8359== by 0x4336B9: opt_parse (opt.c:213)
==8359== by 0x41BB19: main (cgminer.c:6454)
==8359==
==8359== 32 bytes in 1 blocks are definitely lost in loss record 73 of 212
==8359== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x403F4A: string_elist_add (miner.h:528)
==8359== by 0x404C7F: add_serial (cgminer.c:507)
==8359== by 0x433E98: parse_one (parse.c:110)
==8359== by 0x4336B9: opt_parse (opt.c:213)
==8359== by 0x41BB19: main (cgminer.c:6454)
==8359==
==8359== 35 bytes in 2 blocks are definitely lost in loss record 75 of 212
==8359== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x5C83D71: strdup (strdup.c:43)
==8359== by 0x41F810: extract_sockaddr (util.c:872)
==8359== by 0x404DB3: detect_stratum (cgminer.c:558)
==8359== by 0x404EA0: set_url (cgminer.c:582)
==8359== by 0x433E98: parse_one (parse.c:110)
==8359== by 0x4336B9: opt_parse (opt.c:213)
==8359== by 0x41BB19: main (cgminer.c:6454)
==8359==
==8359== 44 bytes in 1 blocks are definitely lost in loss record 82 of 212
==8359== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x41D624: resp_hdr_cb (util.c:129)
==8359== by 0x4E497F2: Curl_client_write (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
==8359== by 0x4E4832D: Curl_http_readwrite_headers (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
==8359== by 0x4E5FC39: Curl_readwrite (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
==8359== by 0x4E61527:
(in /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
==8359== by 0x41E3A9: json_rpc_call (util.c:377)
==8359== by 0x414AC1: pool_active (cgminer.c:4807)
==8359== by 0x417D70: watchpool_thread (cgminer.c:5757)
==8359== by 0x52A1E99: start_thread (pthread_create.c:308)
==8359== by 0x5CEECBC: clone (clone.S:112)
==8359==
==8359== 49 bytes in 1 blocks are definitely lost in loss record 89 of 212
==8359== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x41D624: resp_hdr_cb (util.c:129)
==8359== by 0x4E497F2: Curl_client_write (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
==8359== by 0x4E4832D: Curl_http_readwrite_headers (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
==8359== by 0x4E5FC39: Curl_readwrite (in /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
==8359== by 0x4E61527:
(in /usr/lib/x86_64-linux-gnu/libcurl.so.4.2.0)
==8359== by 0x41E3A9: json_rpc_call (util.c:377)
==8359== by 0x414AC1: pool_active (cgminer.c:4807)
==8359== by 0x41C4D3: main (cgminer.c:6708)
==8359==
==8359== 288 bytes in 1 blocks are possibly lost in loss record 160 of 212
==8359== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x4012074: _dl_allocate_tls (dl-tls.c:297)
==8359== by 0x52A2ABC: pthread_create@@GLIBC_2.2.5 (allocatestack.c:571)
==8359== by 0x414829: init_stratum_thread (cgminer.c:4748)
==8359== by 0x4149F6: pool_active (cgminer.c:4794)
==8359== by 0x41C4D3: main (cgminer.c:6708)
==8359==
==8359== 288 bytes in 1 blocks are possibly lost in loss record 161 of 212
==8359== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x4012074: _dl_allocate_tls (dl-tls.c:297)
==8359== by 0x52A2ABC: pthread_create@@GLIBC_2.2.5 (allocatestack.c:571)
==8359== by 0x41F338: thr_info_create (util.c:767)
==8359== by 0x41C965: main (cgminer.c:6790)
==8359==
==8359== 288 bytes in 1 blocks are possibly lost in loss record 162 of 212
==8359== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x4012074: _dl_allocate_tls (dl-tls.c:297)
==8359== by 0x52A2ABC: pthread_create@@GLIBC_2.2.5 (allocatestack.c:571)
==8359== by 0x41F338: thr_info_create (util.c:767)
==8359== by 0x41CBDD: main (cgminer.c:6850)
==8359==
==8359== 288 bytes in 1 blocks are possibly lost in loss record 163 of 212
==8359== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x4012074: _dl_allocate_tls (dl-tls.c:297)
==8359== by 0x52A2ABC: pthread_create@@GLIBC_2.2.5 (allocatestack.c:571)
==8359== by 0x414829: init_stratum_thread (cgminer.c:4748)
==8359== by 0x4149F6: pool_active (cgminer.c:4794)
==8359== by 0x417D70: watchpool_thread (cgminer.c:5757)
==8359== by 0x52A1E99: start_thread (pthread_create.c:308)
==8359== by 0x5CEECBC: clone (clone.S:112)
==8359==
==8359== 531 (504 direct, 27 indirect) bytes in 1 blocks are definitely lost in loss record 176 of 212
==8359== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x405E0D: make_work (cgminer.c:1361)
==8359== by 0x41CCEC: main (cgminer.c:6886)
==8359==
==8359== 727 (104 direct, 623 indirect) bytes in 1 blocks are definitely lost in loss record 180 of 212
==8359== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x50952B1: json_object (in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x5092C74:
(in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x50930A2:
(in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x5093202: json_loads (in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x41E6F1: json_rpc_call (util.c:425)
==8359== by 0x414AC1: pool_active (cgminer.c:4807)
==8359== by 0x417D70: watchpool_thread (cgminer.c:5757)
==8359== by 0x52A1E99: start_thread (pthread_create.c:308)
==8359== by 0x5CEECBC: clone (clone.S:112)
==8359==
==8359== 1,383 (104 direct, 1,279 indirect) bytes in 1 blocks are definitely lost in loss record 187 of 212
==8359== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x50952B1: json_object (in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x5092C74:
(in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x50930A2:
(in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x5093202: json_loads (in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x41E6F1: json_rpc_call (util.c:425)
==8359== by 0x414CA2: pool_active (cgminer.c:4852)
==8359== by 0x417D70: watchpool_thread (cgminer.c:5757)
==8359== by 0x52A1E99: start_thread (pthread_create.c:308)
==8359== by 0x5CEECBC: clone (clone.S:112)
==8359==
==8359== 65,432 bytes in 1 blocks are definitely lost in loss record 210 of 212
==8359== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x425CF6: _io_new (api.c:652)
==8359== by 0x42DC0D: api (api.c:3684)
==8359== by 0x412662: api_thread (cgminer.c:4348)
==8359== by 0x52A1E99: start_thread (pthread_create.c:308)
==8359== by 0x5CEECBC: clone (clone.S:112)
==8359==
==8359== 672,368 (104 direct, 672,264 indirect) bytes in 1 blocks are definitely lost in loss record 212 of 212
==8359== at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==8359== by 0x50952B1: json_object (in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x5092C74:
(in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x50930A2:
(in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x5093202: json_loads (in /usr/lib/libjansson.so.4.2.1)
==8359== by 0x41E6F1: json_rpc_call (util.c:425)
==8359== by 0x414CA2: pool_active (cgminer.c:4852)
==8359== by 0x41C4D3: main (cgminer.c:6708)
==8359==
==8359== LEAK SUMMARY:
==8359== definitely lost: 66,418 bytes in 12 blocks
==8359== indirectly lost: 674,193 bytes in 3,866 blocks
==8359== possibly lost: 1,152 bytes in 4 blocks
==8359== still reachable: 166,745 bytes in 261 blocks
==8359== suppressed: 0 bytes in 0 blocks
==8359== Reachable blocks (those to which a pointer was found) are not shown.
==8359== To see them, rerun with: --leak-check=full --show-reachable=yes
==8359==
==8359== For counts of detected and suppressed errors, rerun with: -v
==8359== ERROR SUMMARY: 14 errors from 14 contexts (suppressed: 2 from 2)
valgrind --lea
ak-check=full ./cgminer --api-port 9999 --per-device-stats --api-
-network --api-listen -S/dev/ICA0 --icarus-timing=1:38
==8748== Memcheck, a memory error detector
==8748== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==8748== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==8748== Command: ./cgminer xxxxxxxxxx --api-port 9999 --per-device-stats --api-network --api-listen -S/dev/ICA0 --icarus-timing=1:38
==8748==
[2013-02-02 12:00:23] Started cgminer 2.10.4