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