Пример #1
0
        public void Set(int index, bool val)
        {
            lock (_lock)
            {
                if (_state == TYPE.Indexes)
                {
                    isDirty = true;

                    if (val == true)
                    {
                        _offsets.Add((uint)index, true);
                        // set max
                        if (index > _curMax)
                        {
                            _curMax = (uint)index;
                        }
                    }
                    else
                    {
                        _offsets.Remove((uint)index);
                    }

                    ChangeTypeIfNeeded();
                    return;
                }
                CheckBitArray();

                Resize(index);

                internalSet(index, val);
            }
        }
Пример #2
0
 public void FreeMemory()
 {
     _index.FreeMemory();
     try
     {
         List <int> free = new List <int>();
         foreach (var k in _cache.Keys())
         {
             var val = _cache.GetValue(k);
             if (val.isDirty == false)
             {
                 free.Add(k);
             }
         }
         _log.Info("releasing page count = " + free.Count + " out of " + _cache.Count());
         foreach (var i in free)
         {
             _cache.Remove(i);
         }
     }
     catch { }
 }
Пример #3
0
 internal void FreeMemory()
 {
     try
     {
         List <int> free = new List <int>();
         foreach (var k in _cache.Keys())
         {
             var val = _cache.GetValue(k);
             if (val.isDirty == false)
             {
                 free.Add(k);
             }
         }
         log.Info("releasing bmp count = " + free.Count + " out of " + _cache.Count());
         foreach (int i in free)
         {
             _cache.Remove(i);
         }
     }
     catch (Exception ex) {
         log.Error(ex);
     }
 }