Ejemplo n.º 1
0
        private static IntPtr Allocate(int width, int height, out IntPtr handle, bool allowRetry)
        {
            IntPtr block;

            try {
                block = Memory.AllocateBitmap(width, height, out handle);
            } catch (OutOfMemoryException) {
                if (allowRetry)
                {
                    Utility.GCFullCollect();
                    return(Allocate(width, height, out handle, false));
                }
                else
                {
                    throw;
                }
            }

            return(block);
        }