Memory leaks in NSMutableDictionary
<p>When i run the instrument tool i'm getting memory leaks in the following lines,"(NSString *)feedString" is JSON response i'm getting from the server,can any one give and idea how can i fix this memory leak,</p>

<p>Thanks,
Sam,</p>

<p><Code></p>

<pre><code> NSMutableDictionary *allCards = [NSMutableDictionary dictionary];

CardTypeDTO *cardTypeDTO = [[CardTypeDTO alloc] init];

  [cardTypeDTO setImageURL:[[CommonUtility urlDecode:[cardDetail objectForKey:@"imageURL"]] retain]];

  [allCards setValue:cardTypeDTO forKey:[cardDetail objectForKey:@"accountId"]];



-(id)parseFeed:(NSString *)feedString{

 //NSMutableDictionary *allCards = [[NSMutableDictionary alloc] init];
 NSMutableDictionary *allCards = [NSMutableDictionary dictionary];


 NSMutableDictionary *parsedOutput = (NSMutableDictionary *)feedString;

 NSArray *objectKeys = [parsedOutput allKeys];


 for (int i = 0; i &lt; [objectKeys count]; i++) {
  NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init];
  NSMutableDictionary *cardDetail = [parsedOutput objectForKey:[objectKeys objectAtIndex:i]];
  CardTypeDTO *cardTypeDTO = [[CardTypeDTO alloc] init];
  [cardTypeDTO setAccountId:[cardDetail objectForKey:@"accountId"]];
  [cardTypeDTO setCardName:[cardDetail objectForKey:@"cardName"]];
  [cardTypeDTO setBankName:[cardDetail objectForKey:@"bankName"]];
  [cardTypeDTO setCustomMessage:[cardDetail objectForKey:@"customMessage"]];
  [cardTypeDTO setAvailableAmount:[cardDetail objectForKey:@"availableAmount"]];
  [cardTypeDTO setBalanceAmount:[cardDetail objectForKey:@"balanceAmount"]];
  [cardTypeDTO setPercentage:[cardDetail objectForKey:@"percentage"]];
  //[cardTypeDTO setImageURL:[cardDetail objectForKey:@"imageURL"]];
  [cardTypeDTO setImageURL:[[CommonUtility urlDecode:[cardDetail objectForKey:@"imageURL"]] retain]];
  [cardTypeDTO setNickName:[cardDetail objectForKey:@"nickName"]];
  [cardTypeDTO setBalanceStatusCode:[cardDetail objectForKey:@"balanceStatusCode"]];
  [cardTypeDTO setBalanceStatusMsg:[cardDetail objectForKey:@"balanceStatusMsg"]];
  [cardTypeDTO setOnlineLinked:[cardDetail objectForKey:@"onlineLinked"]];
  [cardTypeDTO setCardType:[cardDetail objectForKey:@"cardType"]];

  [allCards setValue:cardTypeDTO forKey:[cardDetail objectForKey:@"accountId"]];
  //[cardTypeDTO release];
  [loopPool release];

 }

 return allCards;
}

+(NSString *) urlDecode: (NSString *) url
{
 NSString *result=[url stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
 return [result autorelease];
}
</code></pre>

<p></Code></p>
