public virtual void FrameEnd(Real timeElapsed) { this.mStrategy.FrameEnd(timeElapsed, this); var ids = new PageID[this.mPages.Count]; this.mPages.Keys.CopyTo(ids, 0); for (int i = 0; i < this.mPages.Count; ++i) { // if this page wasn't used, unload Page p = this.mPages[ids[i]]; if (!p.IsHeld) { UnloadPage(p); // update indices since unloading will invalidate it ids = new PageID[this.mPages.Count]; this.mPages.Keys.CopyTo(ids, 0); // pre-decrement since unloading will remove it --i; } else { p.FrameEnd(timeElapsed); } } }