Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-130

Memory leak on header responses..

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • None
    • 2.0.0beta3
    • None
    • Security Level: Public
    • None
    • lcb 2.0.0

    Description

      memset(&htcmd, 0, sizeof(htcmd));
      OV1(&htcmd).content_type = "application/json";
      OV1(&htcmd).path = vqstr;
      OV1(&htcmd).npath = strlen(vqstr);
      OV1(&htcmd).chunked = 1;
      OV1(&htcmd).method = LCB_HTTP_METHOD_GET;

      rctx->callback = my_vr_callback;
      lcb_set_http_data_callback(instance, http_data_callback);

      err = lcb_make_http_request(instance,
      rctx,
      LCB_HTTP_TYPE_VIEW,
      &htcmd,
      &htreq);
      assert(err == LCB_SUCCESS);
      printf("Waiting for request..\n");
      err = lcb_wait(instance);
      assert (err == LCB_SUCCESS);

      printf("Got query string: %s\n", vqstr);
      free(vqstr);
      lcb_vopt_cleanup_list(&vopt_list, num_options, 1);
      free(vopt_list);
      lcb_vrow_free(rctx);

      /**********************************************************/
      mnunberg@csure:~/src/sdkd-cpp/src/views$ valgrind --leak-check=full ./test
      ==31887== Memcheck, a memory error detector
      ==31887== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
      ==31887== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
      ==31887== Command: ./test
      ==31887==
      Waiting for request..
      Got callback..
      Got status 404
      Parsing bytes '

      {"error":"not_found","reason":"Design document _design/design_doc not found"}

      '
      Got query string: _design/design_doc/_view/view_doc?stale=false&limit=150&debug=true
      ==31887==
      ==31887== HEAP SUMMARY:
      ==31887== in use at exit: 1,915 bytes in 18 blocks
      ==31887== total heap usage: 3,349 allocs, 3,331 frees, 305,322 bytes allocated
      ==31887==
      ==31887== 254 (88 direct, 166 indirect) bytes in 1 blocks are definitely lost in loss record 8 of 10
      ==31887== at 0x4C272B8: calloc (vg_replace_malloc.c:566)
      ==31887== by 0x4E375FE: http_parser_headers_complete_cb (http.c:101)
      ==31887== by 0x4E463ED: http_parser_execute (http_parser.c:1602)
      ==31887== by 0x4E37D11: request_do_read (http.c:262)
      ==31887== by 0x4E37F07: request_event_handler (http.c:320)
      ==31887== by 0x6090CCB: ???
      ==31887== by 0x5E7F536: ???
      ==31887== by 0x4E4301E: lcb_wait (wait.c:112)
      ==31887== by 0x4015A0: schedule_http (main.c:139)
      ==31887== by 0x401B20: main (main.c:304)
      ==31887==
      ==31887== LEAK SUMMARY:
      ==31887== definitely lost: 88 bytes in 1 blocks
      ==31887== indirectly lost: 166 bytes in 10 blocks
      ==31887== possibly lost: 0 bytes in 0 blocks
      ==31887== still reachable: 1,661 bytes in 7 blocks
      ==31887== suppressed: 0 bytes in 0 blocks
      ==31887== Reachable blocks (those to which a pointer was found) are not shown.
      ==31887== To see them, rerun with: --leak-check=full --show-reachable=yes
      ==31887==
      ==31887== For counts of detected and suppressed errors, rerun with: -v
      ==31887== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 10 from 6)

      ==6220== HEAP SUMMARY:
      ==6220== in use at exit: 1,923 bytes in 18 blocks
      ==6220== total heap usage: 3,349 allocs, 3,331 frees, 427,889 bytes allocated
      ==6220==
      ==6220== 262 (88 direct, 174 indirect) bytes in 1 blocks are definitely lost in loss record 8 of 10
      ==6220== at 0x4C272B8: calloc (vg_replace_malloc.c:566)
      ==6220== by 0x4E375FE: http_parser_headers_complete_cb (http.c:101)
      ==6220== by 0x4E4644D: http_parser_execute (http_parser.c:1602)
      ==6220== by 0x4E37D11: request_do_read (http.c:262)
      ==6220== by 0x4E37F07: request_event_handler (http.c:320)
      ==6220== by 0x6090CCB: ???
      ==6220== by 0x5E7F536: ???
      ==6220== by 0x4E4307E: lcb_wait (wait.c:112)
      ==6220== by 0x40158B: schedule_http (main.c:140)
      ==6220== by 0x401AF5: main (main.c:305)
      ==6220==
      ==6220== LEAK SUMMARY:
      ==6220== definitely lost: 88 bytes in 1 blocks
      ==6220== indirectly lost: 174 bytes in 10 blocks
      ==6220== possibly lost: 0 bytes in 0 blocks
      ==6220== still reachable: 1,661 bytes in 7 blocks
      ==6220== suppressed: 0 bytes in 0 blocks
      ==6220== Reachable blocks (those to which a pointer was found) are not shown.
      ==6220== To see them, rerun with: --leak-check=full --show-reachable=yes
      ==6220==
      ==6220== For counts of detected and suppressed errors, rerun with: -v
      ==6220== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 10 from 6)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            avsej Sergey Avseyev
            mnunberg Mark Nunberg (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty