/// <summary> /// Our own delegate implementation responsible for freeing our own allocated additional arbitrary memory /// whenever the game chooses to free a mapped address. /// </summary> /// <param name="memoryTracer">The memoryTracer instance that called the Free Delegate.</param> /// <param name="address">The address that has been freed.</param> /// <param name="memoryAddressDetails">Any extra details about the address that has been freed.</param> private void AfterFreeDelegate(ref MemoryTracer memoryTracer, ref int address, ref MemoryAddressDetails memoryAddressDetails) { // Try to get our own memory mappings for game's memory, then free it. if (AllocationMapping.TryGetValue(address, out List <Mapping> ownMemory)) { for (int x = 0; x < ownMemory.Count; x++) { MemoryTracer.FreeFunction(ownMemory[x].Address); } ownMemory.Clear(); } }