public static void *malloc(long size) { var ptr = Marshal.AllocHGlobal((int)size); MemoryStats.Allocated(); return(ptr.ToPointer()); }