Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Dispose of ctypes to fix np.array holding on to memory for too long (fixes #108) #109

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 3 commits into from
Dec 4, 2022

Conversation

rstarkov
Copy link
Contributor

@rstarkov rstarkov commented Nov 29, 2022

Not entirely sure why ctypes requires explicit disposal but tests show this to be the case.

It is not possible to work-around this issue by calling array.ctypes.Dispose(); it probably creates a whole extra reference and only that gets disposed.

This is also why this PR stores ctypes in a local: getting it again via either ndarray.ctypes or ndarray.PyObject.ctypes just to dispose of it does not work.

fix #108

@rstarkov
Copy link
Contributor Author

I've also pushed a unit test that fails without this fix but passes with it. Didn't include in PR because it's possibly flaky due to how it tests RAM usage. You can see it here and I can add it to this PR if you think it's suitable.

@henon
Copy link
Contributor

henon commented Nov 29, 2022

I've also pushed a unit test that fails without this fix but passes with it. Didn't include in PR because it's possibly flaky due to how it tests RAM usage. You can see it here and I can add it to this PR if you think it's suitable.

ok, sure, please add it. if it turns out too flaky I can still uncomment it, but it is still nice to have it.

@rstarkov
Copy link
Contributor Author

@henon nice, pushed.

@henon henon merged commit 25a5c08 into SciSharp:master Dec 4, 2022
@henon
Copy link
Contributor

henon commented Dec 4, 2022

Thank you very much!

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.

np.array leaks memory
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.