NSMutableArray *fontsDetails=[[NSMutableArray alloc] init];
[fontsDetails addObject:[UIFont systemFontOfSize:28]];
NSArray *fontFamilies = [UIFont familyNames];
for (int i = 0; i < [fontFamilies count]; i++)
{
NSArray *fontNames = [UIFont fontNamesForFamilyName:[fontFamilies objectAtIndex:i]];
@autoreleasepool {
for (NSString *fontName in fontNames) {
[fontsDetails addObject:[UIFont fontWithName:fontName size:28]];
}
}
}
I am using this code in viewDidLoad of a controller, with this code the heap shot difference between the first and second run increases by 5mb and never comes down. (subsequent heap shots differences are lower). I am finding [UIFont fontWithName:] in the backtrace of heap shot, i ran the leak profiler and there are no leaks. All the fonts loaded are kept at heap and never destroyed. Please help me to solve this.