Пример #1
0
        /// <summary>
        ///   Trims the Fallen-8.
        /// </summary>
        private void TrimPrivate()
        {
            for (var i = Constants.MinId; i <= _currentId; i++)
            {
                AGraphElement graphElement;
                if (_graphElements.TryGetElementOrDefault(out graphElement, i))
                {
                    graphElement.Trim();
                }
            }

#if __MonoCS__
            //mono specific code
                        #else
            GC.Collect();
            GC.Collect();
            GC.WaitForFullGCComplete();
            GC.WaitForPendingFinalizers();
#endif

#if __MonoCS__
            //mono specific code
                        #else
            var errorCode = SaveNativeMethods.EmptyWorkingSet(Process.GetCurrentProcess().Handle);
#endif

            RecalculateGraphElementCounter();
        }
Пример #2
0
        /// <summary>
        ///   Trims the Fallen-8.
        /// </summary>
        private void TrimPrivate()
        {
            for (var i = 0; i < _currentId; i++)
            {
                AGraphElement graphElement = _graphElements[i];
                if (graphElement != null)
                {
                    graphElement.Trim();
                }
            }

            List <AGraphElement> newGraphElementList = new List <AGraphElement>();

            //copy the list and exclude nulls
            foreach (var aGraphElement in _graphElements)
            {
                if (aGraphElement != null)
                {
                    newGraphElementList.Add(aGraphElement);
                }
            }

            //check the IDs
            for (int i = 0; i < newGraphElementList.Count; i++)
            {
                newGraphElementList[i].SetId(i);
            }

            //set the correct currentID
            _currentId = newGraphElementList.Count;

            //cleanup and switch
            _graphElements.Clear();
            _graphElements = newGraphElementList;

#if __MonoCS__
            //mono specific code
#else
            GC.Collect();
            GC.Collect();
            GC.WaitForFullGCComplete(-1);
            GC.WaitForPendingFinalizers();
#endif

#if __MonoCS__
            //mono specific code
#else
            var errorCode = SaveNativeMethods.EmptyWorkingSet(Process.GetCurrentProcess().Handle);
#endif

            RecalculateGraphElementCounter();
        }