public static SafeHGlobalHandle AllocHGlobal(int cb)
            {
                if (cb < 0)
                {
                    throw new ArgumentOutOfRangeException("cb", "ValueMustBeNonNegative");
                }

                SafeHGlobalHandle handle = new SafeHGlobalHandle();

                RuntimeHelpers.PrepareConstrainedRegions();
                try
                {
                }
                finally
                {
                    IntPtr ptr = Marshal.AllocHGlobal(cb);
                    handle.SetHandle(ptr);
                }

                return(handle);
            }