Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Likely Minor: cleanup the mutex attributes object after mutex pthread_mutex_init().… #5083

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

dhthwy
Copy link
Contributor

@dhthwy dhthwy commented Dec 6, 2024

… pthread_mutex_init() temporarily uses the attributes object for configuration but does not take any ownership.

There is a memory allocation performed by pthread_mutexattr_init().

Assuming luai_userstateopen() is only called once or rarely, this resolves a small resource leak.

… pthread_mutex_init() temporarily uses the attributes object for configuration but does not take ownership.
Copy link
Member

@ab9rf ab9rf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did verify that, per the spec:

After a mutex attributes object has been used to initialize one or more mutexes, any function affecting the attributes object (including destruction) shall not affect any previously initialized mutexes.

so this is safe

@myk002 myk002 merged commit 5b744e7 into DFHack:develop Dec 7, 2024
14 checks passed
@dhthwy dhthwy deleted the pr5061mem branch December 9, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants