Skip to content

Commit 2634de7

Browse files
committed
dispose temporary storaged only when owner
1 parent f8e1c29 commit 2634de7

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/ConvNetSharp.Volume.GPU/Single/VolumeStorage.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,17 @@ protected virtual void Dispose(bool disposing)
244244
if (this._isOwner)
245245
{
246246
this.DeviceBuffer?.Dispose();
247+
this.ConvolutionBackwardFilterStorage?.Dispose();
248+
this.ConvolutionBackwardStorage?.Dispose();
249+
this.ConvolutionStorage?.Dispose();
250+
this.ReductionStorage?.Dispose();
251+
this.DropoutStorage?.Dispose();
252+
this.DropoutStateStorage?.Dispose();
247253
}
248254
else
249255
{
250256
this.DeviceBuffer = null;
251257
}
252-
253-
this.ConvolutionBackwardFilterStorage?.Dispose();
254-
this.ConvolutionBackwardStorage?.Dispose();
255-
this.ConvolutionStorage?.Dispose();
256-
this.ReductionStorage?.Dispose();
257-
this.DropoutStorage?.Dispose();
258-
this.DropoutStateStorage?.Dispose();
259258
}
260259

261260
private static void FillWithZeroes(IntPtr memoryStart, long size)

0 commit comments

Comments
 (0)