Does the iPhone support garbage collection? If it does, then what are the alternate ways to perform the operations that are performaed using +alloc
and -i
No. Garbage collection is too large an overhead for the limited battery life etc. on the device.
You must program always with an alloc/release
pattern in mind.
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:xmlData];
...
[xmlParser release];
or (not suitable for every situation)
NSXMLParser *xmlParser [[[NSXMLParser alloc] initWithData:xmlData] autorelease];
Hope this helps!