[Vala] What to do about: double free or corruption (fasttop)




Hello,

I am using couchdb-glib-1.0.vapi.  I am porting test-couchdb-glib.c to vala to gain
insight into the library.  

I am intermittantly getting the error in the subject, and I am unsure
how to proceed. 

for instance this code (loop1) completed without error:

                while (array.get_length () > 0) {
                        uint length = array.get_length ();
                        print_debug("before remove: length %u".printf(length));
                        array.remove_element (0);
                        print_debug("after remove: length %u".printf(length));
                        assert (array.get_length () == length - 1);
                }

I then changed it to the snippet below, and the the error occurred:

                uint length = array.get_length (); 
                while (length > 0) {
                        print_debug("before remove: length %u".printf(length));
                        array.remove_element (0);
                        print_debug("after remove: length %u".printf(length));
                        assert (array.get_length () == length - 1);
                        length = array.get_length ();
                }

So, I changed it back and the error still occurred.

The above is just the latest example. It seems as if the cause is
intermittant as well.  

/////////////////////////////////////

Here is the output of this test.
Connecting to Couchdb at http://test:test 127 0 0 1:5985
/testcouchdbglib/TestArrayField: 
begin: test_array_field
  begin: create_fake_array
  end: create_fake_array
  fake array assigned
  fake array nulled
  before loop
  before remove: length 5
  after remove: length 5
  before remove: length 4
  after remove: length 4
  before remove: length 3
  after remove: length 3
  before remove: length 2
  after remove: length 2
  before remove: length 1
*** glibc detected *** ./libcouchtests: double free or corruption (fasttop): 0x09eac1d0 ***
[...]

The complete output is here: http://pastebin.com/ZYYAg1sL

-- 
Regards,
Brian Winfrey




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]