]> git.saurik.com Git - cydia.git/commitdiff
Throw away almost all state on memory warning. v1.1.0%b5
authorJay Freeman (saurik) <saurik@saurik.com>
Fri, 11 Mar 2011 02:09:42 +0000 (18:09 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Fri, 11 Mar 2011 02:09:42 +0000 (18:09 -0800)
MobileCydia.mm

index a1d96f001910824e9fc9e6b84a55db63668a8927..e8ec96e453fec171606daf6e0e60a6e0dcc91434 100644 (file)
@@ -5731,14 +5731,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) releaseSubviews {
     list_ = nil;
 
 - (void) releaseSubviews {
     list_ = nil;
 
+    package_ = nil;
+    files_ = nil;
+
     [super releaseSubviews];
 }
 
 - (id) initWithDatabase:(Database *)database {
     if ((self = [super init]) != nil) {
         database_ = database;
     [super releaseSubviews];
 }
 
 - (id) initWithDatabase:(Database *)database {
     if ((self = [super init]) != nil) {
         database_ = database;
-
-        files_ = [NSMutableArray arrayWithCapacity:32];
     } return self;
 }
 
     } return self;
 }
 
@@ -5746,7 +5747,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     package_ = nil;
     name_ = nil;
 
     package_ = nil;
     name_ = nil;
 
-    [files_ removeAllObjects];
+    files_ = [NSMutableArray arrayWithCapacity:32];
 
     if (package != nil) {
         package_ = package;
 
     if (package != nil) {
         package_ = package;
@@ -6158,18 +6159,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         database_ = database;
         title_ = [title copy];
         [[self navigationItem] setTitle:title_];
         database_ = database;
         title_ = [title copy];
         [[self navigationItem] setTitle:title_];
-
-#if TryIndexedCollation
-        if ([[self class] hasIndexedCollation])
-            index_ = [[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionIndexTitles];
-        else
-#endif
-            index_ = [NSMutableArray arrayWithCapacity:32];
-
-        indices_ = [NSMutableDictionary dictionaryWithCapacity:32];
-
-        packages_ = [NSArray array];
-        sections_ = [NSMutableArray arrayWithCapacity:16];
     } return self;
 }
 
     } return self;
 }
 
@@ -6192,6 +6181,11 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) releaseSubviews {
     list_ = nil;
 
 - (void) releaseSubviews {
     list_ = nil;
 
+    packages_ = nil;
+    sections_ = nil;
+    index_ = nil;
+    indices_ = nil;
+
     [super releaseSubviews];
 }
 
     [super releaseSubviews];
 }
 
@@ -6248,13 +6242,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
     packages_ = packages;
 
 
     packages_ = packages;
 
-    [indices_ removeAllObjects];
-    [sections_ removeAllObjects];
+    indices_ = [NSMutableDictionary dictionaryWithCapacity:32];
+    sections_ = [NSMutableArray arrayWithCapacity:16];
 
     Section *section = nil;
 
 #if TryIndexedCollation
     if ([[self class] hasIndexedCollation]) {
 
     Section *section = nil;
 
 #if TryIndexedCollation
     if ([[self class] hasIndexedCollation]) {
+        index_ = [[objc_getClass("UILocalizedIndexedCollation") currentCollation] sectionIndexTitles];
+
         id collation = [objc_getClass("UILocalizedIndexedCollation") currentCollation];
         NSArray *titles = [collation sectionIndexTitles];
         int secidx = -1;
         id collation = [objc_getClass("UILocalizedIndexedCollation") currentCollation];
         NSArray *titles = [collation sectionIndexTitles];
         int secidx = -1;
@@ -6287,7 +6283,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     } else
 #endif
     {
     } else
 #endif
     {
-        [index_ removeAllObjects];
+        index_ = [NSMutableArray arrayWithCapacity:32];
 
         bool sectioned([self showsSections]);
         if (!sectioned) {
 
         bool sectioned([self showsSections]);
         if (!sectioned) {
@@ -7248,15 +7244,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) releaseSubviews {
     list_ = nil;
 
 - (void) releaseSubviews {
     list_ = nil;
 
+    sections_ = nil;
+    filtered_ = nil;
+
     [super releaseSubviews];
 }
 
 - (id) initWithDatabase:(Database *)database {
     if ((self = [super init]) != nil) {
         database_ = database;
     [super releaseSubviews];
 }
 
 - (id) initWithDatabase:(Database *)database {
     if ((self = [super init]) != nil) {
         database_ = database;
-
-        sections_ = [NSMutableArray arrayWithCapacity:16];
-        filtered_ = [NSMutableArray arrayWithCapacity:16];
     } return self;
 }
 
     } return self;
 }
 
@@ -7265,8 +7261,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
     NSArray *packages = [database_ packages];
 
 
     NSArray *packages = [database_ packages];
 
-    [sections_ removeAllObjects];
-    [filtered_ removeAllObjects];
+    sections_ = [NSMutableArray arrayWithCapacity:16];
+    filtered_ = [NSMutableArray arrayWithCapacity:16];
 
     NSMutableDictionary *sections([NSMutableDictionary dictionaryWithCapacity:32]);
 
 
     NSMutableDictionary *sections([NSMutableDictionary dictionaryWithCapacity:32]);
 
@@ -7430,15 +7426,15 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) releaseSubviews {
     list_ = nil;
 
 - (void) releaseSubviews {
     list_ = nil;
 
+    packages_ = nil;
+    sections_ = nil;
+
     [super releaseSubviews];
 }
 
 - (id) initWithDatabase:(Database *)database {
     if ((self = [super init]) != nil) {
         database_ = database;
     [super releaseSubviews];
 }
 
 - (id) initWithDatabase:(Database *)database {
     if ((self = [super init]) != nil) {
         database_ = database;
-
-        packages_ = [NSArray array];
-        sections_ = [NSMutableArray arrayWithCapacity:16];
     } return self;
 }
 
     } return self;
 }
 
@@ -7483,7 +7479,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         goto reload;
 
     packages_ = packages;
         goto reload;
 
     packages_ = packages;
-    [sections_ removeAllObjects];
+    sections_ = [NSMutableArray arrayWithCapacity:16];
 
     Section *upgradable = [[[Section alloc] initWithName:UCLocalize("AVAILABLE_UPGRADES") localize:NO] autorelease];
     Section *ignored = nil;
 
     Section *upgradable = [[[Section alloc] initWithName:UCLocalize("AVAILABLE_UPGRADES") localize:NO] autorelease];
     Section *ignored = nil;
@@ -8427,13 +8423,14 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) releaseSubviews {
     list_ = nil;
 
 - (void) releaseSubviews {
     list_ = nil;
 
+    sources_ = nil;
+
     [super releaseSubviews];
 }
 
 - (id) initWithDatabase:(Database *)database {
     if ((self = [super init]) != nil) {
         database_ = database;
     [super releaseSubviews];
 }
 
 - (id) initWithDatabase:(Database *)database {
     if ((self = [super init]) != nil) {
         database_ = database;
-        sources_ = [NSMutableArray arrayWithCapacity:16];
     } return self;
 }
 
     } return self;
 }
 
@@ -8444,7 +8441,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
     if ([database_ popErrorWithTitle:UCLocalize("SOURCES") forOperation:list.ReadMainList()])
         return;
 
     if ([database_ popErrorWithTitle:UCLocalize("SOURCES") forOperation:list.ReadMainList()])
         return;
 
-    [sources_ removeAllObjects];
+    sources_ = [NSMutableArray arrayWithCapacity:16];
     [sources_ addObjectsFromArray:[database_ sources]];
     _trace();
     [sources_ sortUsingSelector:@selector(compareByNameAndType:)];
     [sources_ addObjectsFromArray:[database_ sources]];
     _trace();
     [sources_ sortUsingSelector:@selector(compareByNameAndType:)];