All Questions
29 questions
0
votes
1
answer
47
views
IOS Release and assignment messages differences for nsstring
I was going through the memory management concepts. I created one string1 and assign that string1 into another string2, now I release this string1.
Here string2 retain count is 1 but on NSLog ...
1
vote
0
answers
318
views
Properly manage memory to prevent deallocated 'CFString (immutable)' object (zombie)
I have a situation where I have copied a string in an instance of a helper class, retained it, and later released it during the dealloc of the view controller instance that alloc'd the helper class. ...
2
votes
2
answers
543
views
Using Swift to sort array of NSString's results in low memory warning
I'm implementing a search function in which the end result is an Array of NSString, sorted by how closely they resemble the search string. The fuzzy match algorithm is custom, and typically doesn't ...
0
votes
0
answers
215
views
EXC_BAD_ACCESS when passing NSString to method from within a block
I have a method which requests access to Twitter, and then sets the username using - (void) setUsername:(NSString *)username. I have to pass ACAccountStore.requestAccessToAccountsWithType... a ...
-1
votes
1
answer
157
views
Generating string from for loop causes memory overload on iOS
so I'm facing a memory issue here.
I'm trying to generate a GPX string from an array of location objects.
I have this function that parses every object I have in an array, and adds information to the ...
0
votes
1
answer
115
views
Efficiency NSString vs NSInteger/int - only for textual representation
I'd like to know if it would make any sense to cast/convert a number, parsed from a csv file, e.g. customer id, to a NSString?
Or maybe better a simple int? As I'm quite new to obj-c, I'm not really ...
1
vote
2
answers
234
views
Reassign an NSString doesn't free memory
I've got a strange problem about [NSString stringWithFormat:@""];
This is my code:
NSString *log;
[NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(someFunction) userInfo:...
3
votes
2
answers
363
views
NSString and NSMutableString memory considerations
I am trying to wrap my head around NSString and NSMutableString, and how they affect memory.
In my research, I've concluded that if I create an NSString object and give it a value, then change the ...
0
votes
1
answer
95
views
Correct way of NSString manipulation (memory management) when passing to methods and using returned Nsstring object
I have singleton class, having a reusable code for string manipulation, which some times leaks memory.
-(NSString *)getLocalizedString:(NSString *)key
{
@autoreleasepool
{
FMDatabase *db=[...
0
votes
1
answer
117
views
Massive allocations with with CFString while writing to NSOutputStream in iOS
I have problem with large number of allocations while writing to NSOutputStream. I am using few classes together that are supposed to stream data from AudioUnit to remote server. Code below:
...
1
vote
2
answers
2k
views
How should I store a large string, like a user agreement? [closed]
I can use a string literal like @"content", but I think it’s a waste of memory. Is there a custom solution for this situation?
I'm a new Xcoder, so may be this is not a good question, but I'm very ...
3
votes
5
answers
2k
views
Will assigning nil to a retained property release the object associated to it?
when not under ARC, for the following code,
.h
@property (nonatomic, retain) NSString *s;
.m
NSString *m = [NSString stringWithString:@"Hellow, World"];
s = [m retain];
// later on
s = nil; <--...
0
votes
1
answer
92
views
Selecting a sentence from a huge string
I am optimizing an objective-c application, and within that application there is a large NSString containing about 4000 sentences; don't ask why... but there is.
It is randomly selecting a sentence ...
0
votes
1
answer
331
views
Zombie reports: message sent to deallocated instance
I have used the following code.
MainView.h:
NSString *sCopySource;
NSString *sFileSource;
// retain and copy used both for test proposes
@property (nonatomic, retain) NSString *sCopySource;
@...
0
votes
3
answers
548
views
Why do I have to retain/copy this NSString?
I recently rewrote some code in one of my classes, which gave me an error with an NSString. Here is what I have now:
My class header:
@interface MyViewController : UITableViewController {
...