0

似乎 Alea 没有正确处理类 DeviceMemory2D

我检查可用内存的代码

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

这是检查是否有任何泄漏的代码

Seq.init 100 (fun _ -> 
        use arr = Gpu.Default.AllocateDevice<float>(1000,1000) 

        getFreeMemory()
        |> printfn "%d"
    )
|> Seq.iter id

输出

从输出图像来看,内存似乎没有被释放

4

1 回答 1

0

你能试试最新的测试版吗:https ://www.nuget.org/packages/Alea/3.0.4-beta3

于 2017-07-28T20:32:46.783 回答