Objective-c when to release objects

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-04-03T21:14:47Z Indexed on 2010/04/03 21:23 UTC
Read the original article Hit count: 143

Filed under:
|
|
-(IBAction)registerUpdate:(id)sender {
    HTTPRequest* request = [[HTTPRequest alloc] initWithUrl:@"http://www.yahoo.com" delegate:self];
    [request doRequest];
}

The HTTPRequest makes an asynchronous request and calls the onHTTPResponse method in the current class.

My question is do I have to release request? My guess is that I'm supposed to make it an instance variable?

[NSString stringWithFormat:@"Data received: %@", [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]];

How would I release that string object, or should I assign it to a variable?

© Stack Overflow or respective owner

Related posts about memory

Related posts about management