         }
     }
     
+    public override func didReceiveMemoryWarning() {
+        super.didReceiveMemoryWarning()
+        recycledPages.removeAll()
+    }
+    
     // MARK: - set startap values
     private func setStartupValue() {
         startOrientation = UIApplication.sharedApplication().statusBarOrientation.rawValue

        
        // reset local cache
        visiblePages.removeAll()
        
        // set content offset
        pagingScrollView.contentOffset = contentOffsetForPageAtIndex(currentPageIndex)

            lastIndex = numberOfPhotos - 1
        }
        
        //
        for page in visiblePages {
            if let pageIndex = visiblePages.indexOf(page) {
                if (pageIndex < firstIndex || pageIndex > lastIndex) {
                    recycledPages.append(page)
                    page.prepareForReuse() //TODO: - it need to change
                    page.removeFromSuperview()
                    print("Removed page at index \(pageIndex)")
                }
            }
        }
        
        let visibleSet = Set(visiblePages)
        visiblePages = Array(visibleSet.subtract(recycledPages))
        
        while (recycledPages.count > 2) {
            recycledPages.removeFirst()
        }
        
        
        //
        for var index = firstIndex; index <= lastIndex; index++ {
            if isDisplayingPageForIndex(index) {
                continue
