Skip to content

Fix memory leaks #74

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

Merged
merged 1 commit into from
Jun 11, 2019
Merged

Fix memory leaks #74

merged 1 commit into from
Jun 11, 2019

Conversation

Leo1003
Copy link
Contributor

@Leo1003 Leo1003 commented Jun 11, 2019

Here are the two memory leaks I currently found in this repository:

  • Unneeded strdup() in src/linux/InotifyEventLoop.cpp
    • This is easy to fix. Just to remove strdup function call and just pass a C-string; C++ string will make a copy by itself.
  • Not every call to uv_async_send() will yield an execution of the callback (Document).
    • mEventCallbackAsync may not be called. As a result, EventBaton and its events won't be freed by cleanupEventCallback()
    • Also cause event missing.
    • This bug is not easy to fix, since it may need to change the method to pass events in order to fix it.

This pull request currently fixed the first leaks.
Related to #72

@implausible
Copy link
Contributor

implausible commented Jun 11, 2019

Excellent find on both issues. Thanks for fixing the first issue. As to the second issue, perhaps we need to use a mutex and a long living event queue that we can queue / dequeue from on all threads involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants