[lttng-dev] rculfhash: memory leak
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Wed Jun 22 20:27:52 UTC 2016
----- On Jun 22, 2016, at 6:26 AM, Денис Корешков <dynamic-wind at mail.ru> wrote:
> Hello,
> there's a small memory leak in the rculfhash observed under FreeBSD-10 when
> destroying a table.
> The line
> pthread_mutex_init(&ht->resize_mutex, NULL);
> actually calloc's some memory for resize_mutex, and there should be a call to
> pthread_mutex_destroy(3) in cds_lfht_destroy to free it. There's no such call
> in the latest (0.9.2) Userspace RCU.
> Cheers!
Hi,
Thanks for letting me know! It appears that Linux don't allocate
memory for those,which might be why I never stumbled on those
issues.
I just pushed the following string of commits, also taking care of
similar issues with wfcqueue, wfqueue, wfstack and lfstack APIs.
I add to add new "destroy" API to those to handle this.
commit 2af1c19e6a553878fcb2a5106f050d5ed7ac0f54
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date: Wed Jun 22 16:21:43 2016 -0400
Fix: tests: invoke destroy APIs for queues/stacks
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
commit 200d100e05ed8e10c47f971939042f2406df92ef
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date: Wed Jun 22 16:20:25 2016 -0400
Fix: add missing destroy functions to queues/stack APIs
Queues and stack APIs that invoke pthread_mutex_init() should have a
"destroy" counterpart which calls pthread_mutex_destroy(), ortherwise
this causes small memory leaks on platforms where pthread_mutex_init
performs memory allocation.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
commit b4edfa8157bb45827c3236809e550b4d13c0ae22
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date: Wed Jun 22 16:17:37 2016 -0400
Fix: add missing __cds_wfcq_init for LGPL API
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
commit 59629f09c1ee8395b1e22797a6924703e825e345
Author: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Date: Wed Jun 22 15:50:21 2016 -0400
Fix: memory leak on hash table destroy
There is a missing call to pthread_mutex_destroy(3) to match
pthread_mutex_init(3) in the hash table creation.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
Thanks,
Mathieu
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20160622/b5e9dea1/attachment-0001.html>
More information about the lttng-dev
mailing list