コード例 #1
0
        public void Ctor_Dispose_Success(int sizeInMegabytes)
        {
            var memoryFailPoint = new MemoryFailPoint(sizeInMegabytes);

            memoryFailPoint.Dispose();
            memoryFailPoint.Dispose();
        }
コード例 #2
0
ファイル: MemoryManager.cs プロジェクト: divyang4481/abot-1
        public virtual bool IsSpaceAvailable(int sizeInMb)
        {
            if (sizeInMb < 1)
            {
                return(true);
            }

            bool isAvailable = true;

            MemoryFailPoint _memoryFailPoint = null;

            try
            {
                _memoryFailPoint = new MemoryFailPoint(sizeInMb);
            }
            catch (InsufficientMemoryException)
            {
                isAvailable = false;
            }
            catch (NotImplementedException)
            {
                _logger.Warn("MemoryFailPoint is not implemented on this platform. The MemoryManager.IsSpaceAvailable() will just return true.");
            }
            finally
            {
                if (_memoryFailPoint != null)
                {
                    _memoryFailPoint.Dispose();
                }
            }

            return(isAvailable);
        }
コード例 #3
0
ファイル: Tests.netstandard.1.7.cs プロジェクト: jnm2/corefx
        public static void MemoryFailPointTestNoThrow()
        {
            MemoryFailPoint memFailPoint = null;

            memFailPoint = new MemoryFailPoint(1);
            memFailPoint.Dispose();
            memFailPoint = new MemoryFailPoint(2);
            memFailPoint.Dispose();
        }