Start using autorelease.

Much more testing is required (oh, but for qc-valgrind), but there is now
a ~945kB block of free data in the menu progs heap :).

Also, correct the printed size of the memory block to not include the
block header size.
This commit is contained in:
Bill Currie 2010-11-22 14:05:48 +09:00
parent 4518e6af91
commit 3878b76cc5
4 changed files with 8 additions and 8 deletions

View file

@ -263,7 +263,7 @@ Z_Print (memzone_t *zone)
for (block = zone->blocklist.next ; ; block = block->next) {
Sys_Printf ("block:%p size:%7i tag:%3i ofs:%d\n",
block, block->size, block->tag,
block, block->size - sizeof (memblock_t) - 4, block->tag,
(int) ((byte *) block - (byte *) zone));
if (block->next == &zone->blocklist)

View file

@ -224,7 +224,7 @@ PLItem read_plist (void)
}
plist_data = Qreadstring (file, Qfilesize (file));
Qclose (file);
plist = [PLItem newFromString:plist_data];
plist = [PLItem fromString:plist_data];
str_free (plist_data);
return plist;
}

View file

@ -13,7 +13,7 @@
+ (PLItem) newArray;
+ (PLItem) newData:(void[]) data size:(integer) len;
+ (PLItem) newString:(string) str;
+ (PLItem) newFromString:(string) str;
+ (PLItem) fromString:(string) str;
- initWithItem:(plitem_t) item;
- initWithOwnItem:(plitem_t) item;

View file

@ -22,9 +22,9 @@
return [PLString new:str];
}
+ (PLItem) newFromString:(string) str
+ (PLItem) fromString:(string) str
{
return [PLItem itemClass: PL_GetPropertyList (str)];
return [[PLItem itemClass: PL_GetPropertyList (str)] autorelease];
}
+ itemClass:(plitem_t) item
@ -111,12 +111,12 @@
- (PLItem) getObjectForKey:(string) key
{
return [PLItem itemClass: PL_ObjectForKey (item, key)];
return [[PLItem itemClass: PL_ObjectForKey (item, key)] autorelease];
}
- (PLItem) allKeys
{
return [PLItem itemClass: PL_D_AllKeys (item)];
return [[PLItem itemClass: PL_D_AllKeys (item)] autorelease];
}
- addKey:(string) key value:(PLItem) value
@ -152,7 +152,7 @@
- (PLItem) getObjectAtIndex:(integer) index
{
return [PLItem itemClass: PL_ObjectAtIndex (item, index)];
return [[PLItem itemClass: PL_ObjectAtIndex (item, index)] autorelease];
}
- addObject:(PLItem) object