Alexa 没有正确释放内存
Alea doesnt release memory correctly
Alea 似乎没有正确处理 class 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
从输出图像来看,内存似乎没有被释放
你能试试最新的测试版吗:https://www.nuget.org/packages/Alea/3.0.4-beta3
Alea 似乎没有正确处理 class 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
从输出图像来看,内存似乎没有被释放
你能试试最新的测试版吗:https://www.nuget.org/packages/Alea/3.0.4-beta3