[英]memory leaks in the lists tokyocabinet
Do I to use the function free()
after the use:使用后我是否使用函数free()
:
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 ?我是否要free(p)
for: p = (lk_key*) tclistval(list,...)
或tclistdel(list)
删除tclistdel(list)
所有元素?
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.因为返回值的对象是用函数'tclistnew
'创建的,当它不再使用时应该用函数'tclistdel
'删除。
I interpret that to mean that you don't have to iterate over the list and delete each element individually.我认为这意味着您不必遍历列表并单独删除每个元素。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.