it seems that Alea is not disposing class DeviceMemory2D correctly
my code for checking free memory
let getFreeMemory () =
let free = Marshal.AllocHGlobal sizeof<uint64>
let total = Marshal.AllocHGlobal sizeof<uint64>
let freePtr = NativeInterop.NativePtr.ofNativeInt<nativeint> free
let totalPtr = NativeInterop.NativePtr.ofNativeInt<nativeint> total
CUDAInterop.cuMemGetInfo(freePtr, totalPtr)
|> cuSafeCall
let result = NativeInterop.NativePtr.get freePtr 0
Marshal.FreeHGlobal free
Marshal.FreeHGlobal total
uint64 result
And here's the code that checks whether there's any leak
Seq.init 100 (fun _ ->
use arr = Gpu.Default.AllocateDevice<float>(1000,1000)
getFreeMemory()
|> printfn "%d"
)
|> Seq.iter id
From the output image, the memory doesn't seem to be disposed
Can you try the latest beta version: https://www.nuget.org/packages/Alea/3.0.4-beta3