Alea没有正确释放内存

时间:2017-07-28 03:09:06

标签: aleagpu

似乎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

The outputs

从输出图像中,内存似乎没有被处理

1 个答案:

答案 0 :(得分:0)

您可以试用最新的测试版:https://www.nuget.org/packages/Alea/3.0.4-beta3