Vedis Users Forum

about memory-link

append delete sewain.chen@innosmar

Dear Sir,

I have written a simplest test code for vedis(version is: 1.2.6) on Ubuntu14.04(32bit).

1. comple test code
$ gcc main.c vedis.c -o test_vedis

2. run program with valgrind
$ valgrind --tool=memcheck --leak-check=full --show-reachable=yes ./test_vedis

3. got output:
==5219== LEAK SUMMARY:
==5219== definitely lost: 0 bytes in 0 blocks
==5219== indirectly lost: 0 bytes in 0 blocks
==5219== possibly lost: 38,201 bytes in 68 blocks
==5219== still reachable: 0 bytes in 0 blocks
==5219== suppressed: 0 bytes in 0 blocks
==5219==
==5219== For counts of detected and suppressed errors, rerun with: -v
==5219== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)

4. My problem:
possibly lost: 38,201 bytes in 68 blocks =====> why? there are some memory chuck not been freed?

thanks a lot!!

my C code is as follow:

// =================
#include <stdio.h>
#include <string.h>
#include "vedis.h"

int main(int argc, char *argv[])
{
vedis *pStore;
vedis_value *pResult;

int rc;

puts("=========start ============");

char *vdsFile = "1.vds";
do{
// open vedis file
rc = vedis_open(&pStore, vdsFile);
if (rc != VEDIS_OK)
{
printf("open vedis file failed \n");
return -1;
}

/* Execute the simplest command */
int j;
for(j=0;j<0;j++) {
rc = vedis_exec(pStore,"SET test 'Hello World'",-1);
if( rc != VEDIS_OK ){
printf("SET error! \n");
}else {
printf("SET ok! \n");
}
}

printf("close vedis file \n");
vedis_close(pStore);

return 0;
}while(0);
}

// =================

Reply RSS

Replies

append delete #1. chm

You have to shutdown the library if you want to release all the consumed memory. use vedis_lib_shutdown(); [1]

[1]:http://vedis.symisc.net/c_api/vedis_lib.html

Reply

(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.