Ejemplo n.º 1
0
 /// <summary>
 /// Initializes the ViewManager.
 /// </summary>
 /// <param name="mapper"></param>
 public ViewManager(MmfFile mmf, uint viewSize)
 {
     _mmf         = mmf;
     _viewSize    = viewSize;
     _viewsOpen   = new ArrayList();
     _viewsClosed = new ArrayList();
 }
Ejemplo n.º 2
0
        public static MmfFile Create(IntPtr hFile, ulong maxLength)
        {
            if (maxLength < 0)
            {
                throw new ArgumentOutOfRangeException("maxLength");
            }

            MmfFile file = new MmfFile(hFile, maxLength, MemoryProtection.PageReadWrite);

            if (!file.IsPageFile)
            {
                file.SetMaxLength(Math.Max(maxLength, file.FileSize));
            }
            else
            {
                file.SetMaxLength(maxLength);
            }
            return(file);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Maps the file to the memory of the process.
        /// </summary>
        public void OpenMemoryMappedStore(string fileName, uint viewCount, uint viewSize, uint initialSizeMB)
        {
            try
            {
                _fileName      = fileName;
                _viewCount     = viewCount;
                _viewSize      = (uint)SysUtil.AllignViewSize(viewSize);
                _initialSizeMB = initialSizeMB;

                _mmf         = MmfFile.Create(_fileName, _initialSizeMB * StorageProviderBase.MB, false);
                _viewManager = new ViewManager(_mmf, _viewSize);
                _viewManager.CreateInitialViews(_viewCount);
            }
            catch (Exception e)
            {
                //Console.WriteLine("MmfStorage.OpenMemoryMappedStore" + "Error:" + e);
                throw;
            }
        }
Ejemplo n.º 4
0
        private MemArena _lastFreeArena;                   //why loop all the arena for every add.. Lets get to end of arena before actual re-use of previously de-allocated ones.

        public View(MmfFile mmf, uint id, uint size)
        {
            _mmf  = mmf;
            _vid  = id;
            _size = size;
        }