Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Celanup memory when initializing pthread mutex #61
Comments
|
Thanks for the patch it is good to see the code being reviewed by fresh eyes. But in these case I don't believe that the destroy is required ... the attr is allocated on the stack and the storage is reclaimed when the block is exited (just after the places where you're suggesting the destroy should be added). I'll close this issue in a couple of days unless there is new information to suggest my analysis is wrong. Cheers, Ken |
|
For reference, glibc's pthread_mutexattr_destroy() is a no-op. I don't know of an implementation that hangs dynamically allocated data off of a mutexattr (so as to require a _destroy to avoid leaking it), but the POSIX text doesn't seem to forbid it. |
|
OK, thanks Frank ... I'll commit mkushnir's patch as it would seem to be (at worst) harmless. |
kmcdonell
closed this
Jan 21, 2016
|
As a followup, I'm on FreeBSD, and caught it with the help of valrind. Looks like FreeBSD's implementation allocates some extra memory. I thought it's worth of fixing, since I write a long-living app (months uptime), archive contexts would be created as new archives appear, so my memory would slowly grow. |
mkushnir commentedJan 17, 2016
Found missing destroy calls, please find in attachment
out.txt