basho-labs / riak-c-client

Riak C Client
Apache License 2.0
20 stars 8 forks source link

Add utility riak_array #65

Closed hazen closed 10 years ago

hazen commented 10 years ago
bookshelfdave commented 10 years ago

going to Valgrind this in BOS

hazen commented 10 years ago

My test with valgrind on riak_c_cunit doing ONLY the riak_array suite shows leaks only in libevent:

==18105==
==18105== HEAP SUMMARY:
==18105==     in use at exit: 216 bytes in 6 blocks
==18105==   total heap usage: 96 allocs, 90 frees, 17,916 bytes allocated
==18105==
==18105== 32 bytes in 1 blocks are still reachable in loss record 1 of 6
==18105==    at 0x4C2C857: malloc (vg_replace_malloc.c:291)
==18105==    by 0x54A6E79: debug_lock_alloc (evthread.c:161)
==18105==    by 0x54A6A42: event_global_setup_locks_ (event.c:2882)
==18105==    by 0x409DCE: main (registry.c:56)
==18105==
==18105== 32 bytes in 1 blocks are still reachable in loss record 2 of 6
==18105==    at 0x4C2C857: malloc (vg_replace_malloc.c:291)
==18105==    by 0x54A6E79: debug_lock_alloc (evthread.c:161)
==18105==    by 0x54B87A3: evsig_global_setup_locks_ (signal.c:442)
==18105==    by 0x54A6A55: event_global_setup_locks_ (event.c:2884)
==18105==    by 0x409DCE: main (registry.c:56)
==18105==
==18105== 32 bytes in 1 blocks are still reachable in loss record 3 of 6
==18105==    at 0x4C2C857: malloc (vg_replace_malloc.c:291)
==18105==    by 0x54A6E79: debug_lock_alloc (evthread.c:161)
==18105==    by 0x54B6953: evutil_secure_rng_global_setup_locks_ (evutil_rand.c:121)
==18105==    by 0x54A6A67: event_global_setup_locks_ (event.c:2886)
==18105==    by 0x409DCE: main (registry.c:56)
==18105==
==18105== 40 bytes in 1 blocks are still reachable in loss record 4 of 6
==18105==    at 0x4C2C857: malloc (vg_replace_malloc.c:291)
==18105==    by 0x5291DB9: evthread_posix_lock_alloc (evthread_pthread.c:46)
==18105==    by 0x54A7527: evthread_setup_global_lock_ (evthread.c:358)
==18105==    by 0x54A6A42: event_global_setup_locks_ (event.c:2882)
==18105==    by 0x5291F5F: evthread_use_pthreads (evthread_pthread.c:185)
==18105==    by 0x409DD3: main (registry.c:57)
==18105==
==18105== 40 bytes in 1 blocks are still reachable in loss record 5 of 6
==18105==    at 0x4C2C857: malloc (vg_replace_malloc.c:291)
==18105==    by 0x5291DB9: evthread_posix_lock_alloc (evthread_pthread.c:46)
==18105==    by 0x54A7527: evthread_setup_global_lock_ (evthread.c:358)
==18105==    by 0x54B87A3: evsig_global_setup_locks_ (signal.c:442)
==18105==    by 0x54A6A55: event_global_setup_locks_ (event.c:2884)
==18105==    by 0x5291F5F: evthread_use_pthreads (evthread_pthread.c:185)
==18105==    by 0x409DD3: main (registry.c:57)
==18105==
==18105== 40 bytes in 1 blocks are still reachable in loss record 6 of 6
==18105==    at 0x4C2C857: malloc (vg_replace_malloc.c:291)
==18105==    by 0x5291DB9: evthread_posix_lock_alloc (evthread_pthread.c:46)
==18105==    by 0x54A7527: evthread_setup_global_lock_ (evthread.c:358)
==18105==    by 0x54B6953: evutil_secure_rng_global_setup_locks_ (evutil_rand.c:121)
==18105==    by 0x54A6A67: event_global_setup_locks_ (event.c:2886)
==18105==    by 0x5291F5F: evthread_use_pthreads (evthread_pthread.c:185)
==18105==    by 0x409DD3: main (registry.c:57)
==18105==
==18105== LEAK SUMMARY:
==18105==    definitely lost: 0 bytes in 0 blocks
==18105==    indirectly lost: 0 bytes in 0 blocks
==18105==      possibly lost: 0 bytes in 0 blocks
==18105==    still reachable: 216 bytes in 6 blocks
==18105==         suppressed: 0 bytes in 0 blocks
==18105==
==18105== For counts of detected and suppressed errors, rerun with: -v
==18105== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

I've looked in the source and the documentation, but I don't see any obvioius "clean up global locks" function.

If I comment out ALL libevent from the unit test:

==18536==
==18536== HEAP SUMMARY:
==18536==     in use at exit: 0 bytes in 0 blocks
==18536==   total heap usage: 90 allocs, 90 frees, 17,700 bytes allocated
==18536==
==18536== All heap blocks were freed -- no leaks are possible
==18536==
==18536== For counts of detected and suppressed errors, rerun with: -v
==18536== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
bookshelfdave commented 10 years ago

looks good

bookshelfdave commented 10 years ago

bah, feel free to ignore my doc return type comments. Like you say, they'll probably just get out of sync with the code.

============================================================================
Testsuite summary for riak_c_client 0.5
============================================================================
# TOTAL: 1
# PASS:  1
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
bookshelfdave commented 10 years ago

:+1: