NSData from NSURL Memory leak problem
<p>My aim is to convert <code>NSURL</code> to <code>NSData</code> without any memory leaks... I searched lot and found more than one answer from the website but nothing works for me. Can anyone help me?</p>

<p>Below is the method I tried, but so far nothing works:</p>

<pre><code>NSURL *url = [NSURL URLWithString:@"http://images.apple.com/main/rss/hotnews/hotnews.rss"];
NSData *data;
data = [NSData dataWithContentsOfURL:url];

NSError *error;
NSString* contents = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://images.apple.com/main/rss/hotnews/hotnews.rss"] encoding:NSUTF8StringEncoding error:nil];
NSData* xmlData = [contents dataUsingEncoding:NSUTF8StringEncoding];

NSURL *url = [[NSURL alloc]initWithString:@"http://images.apple.com/main/rss/hotnews/hotnews.rss"];
 NSData *data = [[NSData alloc]initWithContentsOfURL:url options:0 error:nil];
 /*do something with data*/
 [data release];
 [url release];
</code></pre>

<p>Note:</p>

<p>When i change my url to <a href="http://www.wikipedia.org" rel="nofollow">http://www.wikipedia.org</a> the code does not have any memory leak... Help me...</p>

<p>Thanks in advance.</p>
