This might be a stupid question, but I'm struggling with some odd memory increase in a loop. So I thought I might have an understanding problem with ARC.
Say, I have a function like this:
+(NSString *)getDocPathToFile:(NSString *)filename{
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:fn];
return path;
}
Now, what happens with the instantiated vars like fileManager, paths, documentsDirectory and path? Are they destroyed after the value gets returned and thus, don't take up any memory?
To explain this a little further: I'm calling this method a couple of times in a loop. Now, in instruments, I can see a constant memory increase in CFString (immutable)
but I fail in tracking down where that CFString is allocated (I'm not using any CoreFoundation-stuff, as far as I'm aware). I'm not sure whether the above function is the culprit, might be something completely different...
Thanks for enlightening me... ;)