memory leaks in the lists tokyocabinet

149 Views Asked by At

Do I to use the function free() after the use:

TCLIST *list = tcbdbrange();

or using enough :

tclistdel(list); 

Do I to free(p) for: p = (lk_key*) tclistval(list,...) or tclistdel(list) delete all elemenst of list ?

1

There are 1 best solutions below

1
unwind On

Haven't you read any documentation? These are typical questions that should be answered by the docs. As a matter of fact, they are:

Because the object of the return value is created with the function 'tclistnew', it should be deleted with the function 'tclistdel' when it is no longer in use.

I interpret that to mean that you don't have to iterate over the list and delete each element individually.