[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Solved: big memory leak in GSString
From: |
Pirmin Braun |
Subject: |
Re: Solved: big memory leak in GSString |
Date: |
Mon, 14 Jan 2013 13:43:37 +0100 |
after implementing a compare: method in PBIDMLine and replacing the
sortUsingKeyOrderArray: by sortUsingSelector:@selector(compare:) it works; the
memory consumption is back down to 57 MB. Thanks to all who helped!
btw. the sortUsingKeyOrderArray: wasn't from GNUStep, I guess it came from GDL;
it looked like that:
- (void) sortUsingKeyOrderArray: (NSArray *)orderArray
{
if ([self count] > 1)
{
[self sortUsingFunction:compareUsingSortOrderings context:orderArray];
}
}
static NSComparisonResult
compareUsingSortOrderings(id left,
id right,
void* vpSortOrders)
{
NSArray *sortOrders = (NSArray *)vpSortOrders;
NSComparisonResult r = NSOrderedSame;
unsigned int i;
unsigned int sortOrdCnt = [sortOrders count];
/* Loop over all sort orderings until we have an ordering difference. */
for (i=0; (r == NSOrderedSame) && (i < sortOrdCnt); i++){
PBSortOrdering *sortOrd = [sortOrders objectAtIndex: i];
NSString *key = [sortOrd key];
SEL compSel = [sortOrd selector];
id leftVal = [left valueForKeyPath: key];
id rightVal = [right valueForKeyPath: key];
NSComparisonResult (*imp)(id, SEL, id);
if(!leftVal && !rightVal)continue;
if(!leftVal)return NSOrderedAscending;
if(!rightVal)return NSOrderedDescending;
imp = (NSComparisonResult (*)(id, SEL, id))[leftVal methodForSelector:
compSel];
NSCAssert3(imp!=NULL,
@"Invalid comparison selector:%@ for object:<%@ 0x%x>",
NSStringFromSelector(compSel),
NSStringFromClass([leftVal class]),
leftVal);
r = (*imp)(leftVal, compSel, rightVal);
}
return r;
}
--
Pirmin Braun - IntarS Unternehmenssoftware GmbH - Sinziger Str. 29a - 53424
Remagen
+49 2642 308288 +49 174 9747584 - skype:pirminb www.intars.de address@hidden
intars.sourceforge.net
Geschäftsführer: Pirmin Braun, Ralf Engelhardt Registergericht: Amtsgericht
Coburg HRB3136
- Re: big memory leak in GSString, (continued)
- Re: big memory leak in GSString, Pirmin Braun, 2013/01/08
- Re: big memory leak in GSString, David Chisnall, 2013/01/08
- Re: big memory leak in GSString, Pirmin Braun, 2013/01/08
- Re: big memory leak in GSString, Richard Frith-Macdonald, 2013/01/08
- Re: big memory leak in GSString, Chan Maxthon, 2013/01/08
- Re: big memory leak in GSString, Richard Frith-Macdonald, 2013/01/08
- Re: big memory leak in GSString, Fred Kiefer, 2013/01/13
- Re: big memory leak in GSString, David Chisnall, 2013/01/13
- Re: big memory leak in GSString, Fred Kiefer, 2013/01/13
- Partially solved: big memory leak in GSString, Pirmin Braun, 2013/01/14
- Re: Solved: big memory leak in GSString,
Pirmin Braun <=
- Re: big memory leak in GSString, Richard Frith-Macdonald, 2013/01/08