Loading files
7f9864208This file is pinned to the selected release. Download the original to open it in your design tool.
using Hast.Communication.Models;
using Hast.Layer;
using Hast.Transformer.SimpleMemory;
namespace Hast.Communication.Services;
public class MemoryResourceChecker : IMemoryResourceChecker
{
public MemoryResourceProblem EnsureResourceAvailable(SimpleMemory memory, IHardwareRepresentation hardwareRepresentation)
{
var availableBytes = hardwareRepresentation.DeviceManifest.AvailableMemoryBytes;
var memoryByteCount = (ulong)memory.ByteCount;
if (memoryByteCount > availableBytes)
{
return new MemoryResourceProblem
{
Sender = this,
Message = string.Empty,
AvailableByteCount = availableBytes,
MemoryByteCount = memoryByteCount,
};
}
return null;
}
}