Skip to content

Remove memory leaks, with this patch it doesn't leak anymore (Windows… #2125

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

Closed
wants to merge 2 commits into from

Conversation

erwincoumans
Copy link

@erwincoumans erwincoumans commented Feb 28, 2020

… Visual Studio, checked using Visual Leak Detector, https://kinddragon.github.io/vld)

This patch uses Py_AtExit to make sure memory is deallocated at the very end.
It may conflict with other platforms/configurations (embedded etc).

The static PyModuleDef def2; assumes there is only one single PYBIND11_MODULE.
In case more modules are allowed, that part of the patch can be removed and a more fancy solution for that deallocation is needed.

These leaks are similar to Issue #2062
However, in my case I'm seeing memory leaks just using a simple plain Python plugin using pybind11 (not embedded).

… Visual Studio, checked using Visual Leak Detector, https://kinddragon.github.io/vld)

This patch uses Py_AtExit to make sure it is called at the very end. It may conflict with other platforms/configurations (embedded etc).
@erwincoumans
Copy link
Author

Closing, this may be a Windows only issue (looking at the CI errors)

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.

1 participant