`AccessViolationException` in `TorchTensor.Dispose`
See original GitHub issueBy following memory guide, I added GC.Collect
into my code after every epoch. The first such call after an epoch of training crashes with
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at TorchSharp.Tensor.TorchTensor.THSTensor_dispose(IntPtr) at TorchSharp.Tensor.TorchTensor.THSTensor_dispose(IntPtr) at TorchSharp.Tensor.TorchTensor.Dispose(Boolean) at TorchSharp.Tensor.TorchTensor.Finalize()
Repro steps (requires .NET 3.1 Core and C# 9, Windows only):
- Clone https://github.com/losttech/Torch.Siren.git
- Checkout TorchSharpBugs/315
- go to
app
subfolder dotnet run path_to_image.jpg
When done from command line, simply crashes with Fatal error. Internal CLR error. (0x80131506)
When run from Visual Studio (use Siren.sln
at the root), also displayed the stack trace.
Without the call to GC.Collect
memory is leaking fast.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
I think I have a fix.
Fixed with #317 having been merged.