public void Commit(bool freeMemory) { if (_isDirty == false) { return; } using (new L(this)) { log.Debug("writing " + _FileName); int[] keys = _cache.Keys(); Array.Sort(keys); foreach (int k in keys) { WAHBitArray bmp = null; if (_cache.TryGetValue(k, out bmp) && bmp.isDirty) { SaveBitmap(k, bmp); bmp.FreeMemory(); bmp.isDirty = false; } } Flush(); if (freeMemory) { _cache = //new SafeDictionary<int, WAHBitArray>(); new SafeSortedList <int, WAHBitArray>(); log.Debug(" freeing cache"); } _isDirty = false; } }
public void Commit(bool freeMemory) { if (_isDirty == false) { return; } using (new L(this)) { log.Debug("writing " + _FileName); int[] keys = _cache.Keys.OrderBy(x => x).ToArray(); foreach (int k in keys) { WAHBitArray bmp = null; if (_cache.TryGetValue(k, out bmp) && bmp.isDirty) { SaveBitmap(k, bmp); bmp.FreeMemory(); bmp.isDirty = false; } } Flush(); if (freeMemory) { //if (Global.UseLessMemoryStructures) // _cache = new SafeSortedList<int, WAHBitArray>(); //else _cache = new ConcurrentDictionary <int, WAHBitArray>(); log.Debug(" freeing cache"); } _isDirty = false; } }
public void FreeMemory() { lock (_lock) { SaveIndex(); _bits.FreeMemory(); } }
public void FreeMemory() { lock (_lock) { SaveIndex(); _bits.FreeMemory(); // free memory //_bits.FreeMemory(); // save to disk //SaveIndex(); } }
public void FreeMemory() { // free memory _bits.FreeMemory(); }