Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. #include <glib.h>
  2.  
  3. int main (int argc, char *argv[])
  4. {
  5. GHashTable *ht;
  6. ht=g_hash_table_new(g_str_hash,g_str_equal);
  7. g_hash_table_insert(ht,"foo","bar");
  8. g_hash_table_destroy(ht);
  9. return 0;
  10. }
  11.  
  12. # G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --leak-check=full --show-reachable=yes ./test_vg
  13. ==1880== Memcheck, a memory error detector
  14. ==1880== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
  15. ==1880== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
  16. ==1880== Command: ./test_vg
  17. ==1880==
  18. ==1880==
  19. ==1880== HEAP SUMMARY:
  20. ==1880== in use at exit: 1,260 bytes in 3 blocks
  21. ==1880== total heap usage: 5 allocs, 2 frees, 1,524 bytes allocated
  22. ==1880==
  23. ==1880== 252 bytes in 1 blocks are still reachable in loss record 1 of 3
  24. ==1880== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
  25. ==1880== by 0x35C8241707: g_malloc0 (in /lib64/libglib-2.0.so.0.2200.5)
  26. ==1880== by 0x35C8255742: ??? (in /lib64/libglib-2.0.so.0.2200.5)
  27. ==1880== by 0x35C825669D: g_slice_alloc (in /lib64/libglib-2.0.so.0.2200.5)
  28. ==1880== by 0x35C822B1D2: g_hash_table_new_full (in /lib64/libglib-2.0.so.0.2200.5)
  29. ==1880== by 0x400671: main (in /home/data/test_vg)
  30. ==1880==
  31. ==1880== 504 bytes in 1 blocks are still reachable in loss record 2 of 3
  32. ==1880== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
  33. ==1880== by 0x35C8241707: g_malloc0 (in /lib64/libglib-2.0.so.0.2200.5)
  34. ==1880== by 0x35C8255722: ??? (in /lib64/libglib-2.0.so.0.2200.5)
  35. ==1880== by 0x35C825669D: g_slice_alloc (in /lib64/libglib-2.0.so.0.2200.5)
  36. ==1880== by 0x35C822B1D2: g_hash_table_new_full (in /lib64/libglib-2.0.so.0.2200.5)
  37. ==1880== by 0x400671: main (in /home/data/test_vg)
  38. ==1880==
  39. ==1880== 504 bytes in 1 blocks are still reachable in loss record 3 of 3
  40. ==1880== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
  41. ==1880== by 0x35C8241707: g_malloc0 (in /lib64/libglib-2.0.so.0.2200.5)
  42. ==1880== by 0x35C825578B: ??? (in /lib64/libglib-2.0.so.0.2200.5)
  43. ==1880== by 0x35C825669D: g_slice_alloc (in /lib64/libglib-2.0.so.0.2200.5)
  44. ==1880== by 0x35C822B1D2: g_hash_table_new_full (in /lib64/libglib-2.0.so.0.2200.5)
  45. ==1880== by 0x400671: main (in /home/data/test_vg)
  46. ==1880==
  47. ==1880== LEAK SUMMARY:
  48. ==1880== definitely lost: 0 bytes in 0 blocks
  49. ==1880== indirectly lost: 0 bytes in 0 blocks
  50. ==1880== possibly lost: 0 bytes in 0 blocks
  51. ==1880== still reachable: 1,260 bytes in 3 blocks
  52. ==1880== suppressed: 0 bytes in 0 blocks
  53. ==1880==
  54. ==1880== For counts of detected and suppressed errors, rerun with: -v
  55. ==1880== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 6 from 6)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement