anybody with iphone and/or objective c knowledge: please have a look: NSString constrainedToSize problem
category: general [glöplog]
hello fellow softworkers!
after years of passivly abusing the random image thread, this is my first post (=desperate need of help). any idea would be greatly appreciated! for an iphone project, we use
sizeWithFont:constrainedToSize:
problem: the function allocates memory that is not released afterwards. with several thousand calls, this eats up a lot of memory. too much memory.
example:
CGSize theSize;
NSString *myString;
UIFont *tmpfont = [UIFont fontWithName:@"Arial" size:20];
for all strings...
{
myString = [[NSString alloc] initWithString:@"Teststring"];
theSize = [myString sizeWithFont:tmpfont constrainedToSize:CGSizeMake(MAXFLOAT,MAXFLOAT)];
[myString release];
}
thanks so much!
vmp
try autorelease pool myString = [ [[NSString alloc] initWithString:@"Teststring"] autorelease] so it should be automatically released when it goes out of scope ( when the reference count is 0 )
Hope it helps :)
Hope it helps :)
of course, in this case you won't need the [myString release];
what c0d3rguy said
Texel is that you? :)
i don't think it is he. but who can be sure these days :)
who would've thought there were two roman corteses in the scene!
no, it's not me...
Anyway, I believe we are all Roman Cortes, so... thanks for using my avatar :)
true, true... we are all ninjas of dma also :)
thanks for your help. it turned out that the problem only shows up when we use chinese characters. that is a problem...
thanks anyhow, sph
thanks anyhow, sph