Memory leak in string interop
- Dominant language
- C#
- Stars
- 1.9k
- Forks
- 228
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
Research direction
Start by tracing TorchSharp's string interop use of PinnedArray and the proposed PinnedPtrArray. No file or test is named, so locate those types and inspect their disposal behavior first. Done means the interop handles are released when the array is disposed and the relevant tests pass; note that linked pull request 968 was merged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100