public static void AllocHGlobal_IntPtr_ReadableWritable(int size) { IntPtr p = Marshal.AllocHGlobal((IntPtr)size); Assert.NotEqual(IntPtr.Zero, p); try { WriteBytes(p, size); VerifyBytes(p, size); } finally { Marshal.FreeHGlobal(p); } }