Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

valgrind: memory leak #404

Closed
extraSix opened this issue Mar 12, 2018 · 2 comments
Closed

valgrind: memory leak #404

extraSix opened this issue Mar 12, 2018 · 2 comments

Comments

@extraSix
Copy link

extraSix commented Mar 12, 2018

==27526==
==27526== HEAP SUMMARY:
==27526== in use at exit: 561,027 bytes in 13 blocks
==27526== total heap usage: 243 allocs, 230 frees, 1,419,780 bytes allocated
==27526==
==27526== 43 bytes in 5 blocks are indirectly lost in loss record 1 of 8
==27526== at 0x4C2AB80: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27526== by 0x5757B49: strdup (strdup.c:42)
==27526== by 0x54C78FF: json_object_object_add (json_object.c:390)
==27526== by 0x54C8BFB: json_tokener_parse_ex (json_tokener.c:823)
==27526== by 0x54CA2C6: json_tokener_parse_verbose (json_tokener.c:174)
==27526== by 0x54CA31D: json_tokener_parse (json_tokener.c:162)
==27526== by 0x4042F4: get_domain_ip (dal_client.c:95)
==27526== by 0x40291B: process_request (server.c:96)
==27526== by 0x403543: run (threadpool.c:48)
==27526== by 0x4E3F183: start_thread (pthread_create.c:312)
==27526== by 0x57CCFFC: clone (clone.S:111)
==27526==
==27526== 72 bytes in 1 blocks are indirectly lost in loss record 2 of 8
==27526== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27526== by 0x54C7161: json_object_new (json_object.c:184)
==27526== by 0x54C79BC: json_object_new_boolean (json_object.c:449)
==27526== by 0x54C8D4D: json_tokener_parse_ex (json_tokener.c:652)
==27526== by 0x54CA2C6: json_tokener_parse_verbose (json_tokener.c:174)
==27526== by 0x54CA31D: json_tokener_parse (json_tokener.c:162)
==27526== by 0x4042F4: get_domain_ip (dal_client.c:95)
==27526== by 0x40291B: process_request (server.c:96)
==27526== by 0x403543: run (threadpool.c:48)
==27526== by 0x4E3F183: start_thread (pthread_create.c:312)
==27526== by 0x57CCFFC: clone (clone.S:111)
==27526==
==27526== 88 bytes in 1 blocks are indirectly lost in loss record 3 of 8
==27526== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27526== by 0x54CAE4A: lh_table_new (linkhash.c:434)
==27526== by 0x54C763B: json_object_new_object (json_object.c:364)
==27526== by 0x54C99F7: json_tokener_parse_ex (json_tokener.c:283)
==27526== by 0x54CA2C6: json_tokener_parse_verbose (json_tokener.c:174)
==27526== by 0x54CA31D: json_tokener_parse (json_tokener.c:162)
==27526== by 0x4042F4: get_domain_ip (dal_client.c:95)
==27526== by 0x40291B: process_request (server.c:96)
==27526== by 0x403543: run (threadpool.c:48)
==27526== by 0x4E3F183: start_thread (pthread_create.c:312)
==27526== by 0x57CCFFC: clone (clone.S:111)
==27526==
==27526== 96 bytes in 1 blocks are still reachable in loss record 4 of 8
==27526== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27526== by 0x403906: create_queue (queue.c:24)
==27526== by 0x4032AA: start_service (server.c:251)
==27526== by 0x402523: main (main.c:186)
==27526==
==27526== 144 bytes in 2 blocks are indirectly lost in loss record 5 of 8
==27526== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27526== by 0x54C7161: json_object_new (json_object.c:184)
==27526== by 0x54C7B3D: json_object_new_int64 (json_object.c:534)
==27526== by 0x54C9C84: json_tokener_parse_ex (json_tokener.c:699)
==27526== by 0x54CA2C6: json_tokener_parse_verbose (json_tokener.c:174)
==27526== by 0x54CA31D: json_tokener_parse (json_tokener.c:162)
==27526== by 0x4042F4: get_domain_ip (dal_client.c:95)
==27526== by 0x40291B: process_request (server.c:96)
==27526== by 0x403543: run (threadpool.c:48)
==27526== by 0x4E3F183: start_thread (pthread_create.c:312)
==27526== by 0x57CCFFC: clone (clone.S:111)
==27526==
==27526== 512 bytes in 1 blocks are indirectly lost in loss record 6 of 8
==27526== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27526== by 0x54CAE6C: lh_table_new (linkhash.c:439)
==27526== by 0x54C763B: json_object_new_object (json_object.c:364)
==27526== by 0x54C99F7: json_tokener_parse_ex (json_tokener.c:283)
==27526== by 0x54CA2C6: json_tokener_parse_verbose (json_tokener.c:174)
==27526== by 0x54CA31D: json_tokener_parse (json_tokener.c:162)
==27526== by 0x4042F4: get_domain_ip (dal_client.c:95)
==27526== by 0x40291B: process_request (server.c:96)
==27526== by 0x403543: run (threadpool.c:48)
==27526== by 0x4E3F183: start_thread (pthread_create.c:312)
==27526== by 0x57CCFFC: clone (clone.S:111)
==27526==
==27526== 931 (72 direct, 859 indirect) bytes in 1 blocks are definitely lost in loss record 7 of 8
==27526== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27526== by 0x54C7161: json_object_new (json_object.c:184)
==27526== by 0x54C760A: json_object_new_object (json_object.c:360)
==27526== by 0x54C99F7: json_tokener_parse_ex (json_tokener.c:283)
==27526== by 0x54CA2C6: json_tokener_parse_verbose (json_tokener.c:174)
==27526== by 0x54CA31D: json_tokener_parse (json_tokener.c:162)
==27526== by 0x4042F4: get_domain_ip (dal_client.c:95)
==27526== by 0x40291B: process_request (server.c:96)
==27526== by 0x403543: run (threadpool.c:48)
==27526== by 0x4E3F183: start_thread (pthread_create.c:312)
==27526== by 0x57CCFFC: clone (clone.S:111)
==27526==
==27526== 560,000 bytes in 1 blocks are still reachable in loss record 8 of 8
==27526== at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==27526== by 0x40397E: create_queue (queue.c:31)
==27526== by 0x4032AA: start_service (server.c:251)
==27526== by 0x402523: main (main.c:186)
==27526==
==27526== LEAK SUMMARY:
==27526== definitely lost: 72 bytes in 1 blocks
==27526== indirectly lost: 859 bytes in 10 blocks
==27526== possibly lost: 0 bytes in 0 blocks
==27526== still reachable: 560,096 bytes in 2 blocks
==27526== suppressed: 0 bytes in 0 blocks
==27526==
==27526== For counts of detected and suppressed errors, rerun with: -v
==27526== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Some leak cause by json_c(json-c-0.12.1.zip).
Does anyone have such a problem?

@extraSix
Copy link
Author

Using the latest realease(json-c-0.13.1-20180305), I got the same result.

@extraSix
Copy link
Author

Sorry, it's my code's error.
I didn't use json_object_put to release json_object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant