public static byte *AllocZero(int c, NativeMemoryType t = NativeMemoryType.None) { byte *p = Alloc(c, t); FillZero(p, c); return(p); }
public static byte *Alloc(int c, NativeMemoryType t_ = NativeMemoryType.None) { int t = (int)t_; int m = c + 8; byte *p = (byte *)Marshal.AllocHGlobal(m).ToPointer(); int * d = (int *)p; d[0] = m; d[1] = t; Interlocked.Add(ref totalInfo.size, m); Interlocked.Increment(ref totalInfo.count); if (0 <= t && t < cInfo) { Interlocked.Add(ref typeInfos[t].size, m); Interlocked.Increment(ref typeInfos[t].count); } return(p + 8); }