objective c - Greedy NSProgressIndicator Allocation -
i'm using bunch of nsprogressindicators @ once (32 exact) , looks when they're animating start allocating memory no one's business greedy_run http://i62.tinypic.com/15rgmso.png
i've got reports app slowdown , crash after days of uptime, , looks culprit, it's hard pinpoint bugs take days appear.
i comment out call start animating, memory behaves expected. result of multiple nsprogressindicators alloc'ed on same thread? or maybe sandboxing? of constant allocations coming core animation threads, don't know else going on.
custom nsview progress indicator lives in
@interface myview () @property (nonatomic, strong) nsimageview *imageview; @property (nonatomic, strong) nstextview *numbertxt; @property (nonatomic, strong) nsprogressindicator *progress; @end @implementation myview - (id)initwithframe:(nsrect)framerect { self = [super initwithframe:framerect]; if (self) { // image nsimage *image = [nsimage imagenamed:@"bg.png"]; cgrect rect = cgrectmake(0, 0, image.size.width, image.size.height); self.imageview = [[nsimageview alloc] initwithframe:nsrectfromcgrect(rect)]; self.imageview.image = image; [self addsubview:self.imageview]; // number cgrect numberrect = cgrectmake(0, 30, image.size.width, 40); self.numbertxt = [[nstextview alloc] initwithframe:nsrectfromcgrect(numberrect)]; [self.numbertxt setbackgroundcolor:[nscolor clearcolor]]; [self.numbertxt seteditable:no]; [self.numbertxt setfont:[nsfont systemfontofsize:30]]; [self.numbertxt settextcolor:[nscolor redcolor]]; [self addsubview:self.numbertxt]; // progress cgrect progressrect = cgrectmake(self.frame.size.width * 0.5 - 20, self.frame.size.height * 0.5 - 20, 40, 40); self.progress = [[nsprogressindicator alloc] initwithframe:nsrectfromcgrect(progressrect)]; [self.progress setstyle:nsprogressindicatorspinningstyle]; //this line, when commented, fixes things [self.progress startanimation:self]; // [self addsubview:self.progress]; } return self; }
Comments
Post a Comment