public static void DecreaseMemoryUse(uint aSize) { mStartAddress -= aSize; if (mStartAddress < HMI.ProtectArea) { HMI.CauseProgramFault("[ Heap Error: Memory Access Violation ]"); } else { LastMallocAddr = mStartAddress; } }
public static void CheckForErrors(uint aSize) { //Check if address is Zero if (JediReallocAddr == 0 & GCEnable == true & GCObjCount > 0) { Console.Clear(); Console.Write("Debug ID: "); Console.WriteLine(GCDebugID.ToHex()); Console.Write("Index ID: "); Console.WriteLine(GCIndex.ToHex()); Console.Write("GCMax ID: "); Console.WriteLine(GCObjIDs[(GCObjCount - 1)].ToHex()); Console.WriteLine("Realloc Error: Base Memory Address is Zero"); Console.Write("Requested Memory: "); Console.WriteLine(aSize.ToString()); if (GCObjCount == 0) { Console.WriteLine("No objects in GC List."); } int aIndex = GCObjIDs[GCIndex]; uint DataSize = MemSizes[aIndex]; Console.Write("Block# "); Console.Write(aIndex.ToString() + ": "); Console.WriteLine(DataSize.ToString()); while (true) { } ; } //Cause a Heap Fault if an object illegally accesses Kernel Memory Area else if (JediReallocAddr != 0 & JediReallocAddr < ProtectArea & GCEnable == true) { HMI.CauseProgramFault("[ HMI Error: Kernel Memory Access Violation ]"); while (true) { ; } } }