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

Memory leak in string interop #966

Open
zgxnet opened this issue Mar 25, 2023 · 3 comments
Open

Memory leak in string interop #966

zgxnet opened this issue Mar 25, 2023 · 3 comments

Comments

@zgxnet
Copy link

zgxnet commented Mar 25, 2023

TorchSharp uses PinnedArray for string interop, and it does not release the handles explicitly and wishes PinnedArray to release the IntPtr handles when disposing. However, PinnedArray auto-release needs IDisposable to work with, which IntPtr does not implement. I suggest using a dedicated PinnedPtrArray, which is able to release all the handles properly.

@NiklasGustafsson
Copy link
Contributor

@zgxnet -- thank you for noticing this problem. I will take a look at it and see what we can do. You're also welcome to submit a PR with a fix.

@zgxnet
Copy link
Author

zgxnet commented Nov 19, 2023

It seems that the problem is not fixed.

@NiklasGustafsson
Copy link
Contributor

You are right -- it was linked to a PR that I had first imagined would take care of it, but with numerous process crashes, it turned into a much smaller change. The problem remains.

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

No branches or pull requests

2 participants