public static void free(void *a) { if (a == null) { return; } var ptr = new IntPtr(a); Marshal.FreeHGlobal(ptr); MemoryStats.Freed(); }