public bool Allocate(Application app) { MemAppData memdata = GetMemAppData(app); switch (AllocationMode) { case MemAllowcationMode.First: #region Alloc First for (int i = 0; i < Blocks.Count; i++) { if (Blocks[i].AvaliableMemory >= memdata.MemorySize) { app.MemBlockIndex = i; Blocks[i].Alloc(memdata); OnBlockChanged?.Invoke(i, Blocks[i]); return(true); } } #endregion break; case MemAllowcationMode.Best: break; case MemAllowcationMode.Next: break; case MemAllowcationMode.Worst: break; default: break; } return(false); }
public void DeAllocate(Application app) { Blocks[app.MemBlockIndex].DeAlloc(app.AppProcess.ProcessID); OnBlockChanged?.Invoke(app.MemBlockIndex, Blocks[app.MemBlockIndex]); }