开发者

GData Objective C client memory leak

开发者 https://www.devze.com 2023-02-28 21:01 出处:网络
I have a method where I fetchGDataFeedBa开发者_Python百科se entries and return these as an array to another function

I have a method where I fetch GDataFeedBa开发者_Python百科se entries and return these as an array to another function

NSMutableArray *tempFeedArray = [NSMutableArray array]; 
NSURL *feedURL = [[NSURL alloc] initWithString:escapedUrlString];
NSData *data = [NSData dataWithContentsOfURL:feedURL];
GDataFeedBase *feedBase = [[GDataFeedBase alloc] initWithData:data];
[tempFeedArray addObjectsFromArray:[feedBase entries]];
[feedURL release];
[feedBase release];
return tempFeedArray;

.....

I have another function where I retrieve required values from tempFeedArray object that is GDataEntryYouTubeVideo

  for(int count  = 0; count < loopCount; count ++){
        NSMutableDictionary *feedBaseEntryDict = [[NSMutableDictionary alloc] init];

        entry = [tempFeedArray objectAtIndex:count];


        youTubeUrl = [[entry alternateLink] href];


        if ([entry statistics]!= nil) {
            noOfVws= [[[entry statistics] viewCount] intValue];

        }

        duratn = [[[entry mediaGroup] duration] stringValue];
        descr = [[[entry mediaGroup] mediaDescription] stringValue];
        authorName = [[[entry authors] objectAtIndex:0] name];
        publishedDt = [[entry publishedDate] stringValue];
        rating = [[[entry rating] average] stringValue];
        imageURL = [[[[entry mediaGroup] mediaThumbnails] objectAtIndex:0] URLString];
        videoTitle = [[[entry mediaGroup] mediaTitle] stringValue];

  .....
 }



......

For the first time everything works fine. But the next time, it shows memory leak at GDataXMLNode stringFromXMLString:

Did anyone else face this issue?

I found similar issue raised in gdata developer forum: http://groups.google.com/group/gdata-objectivec-client/browse_thread/thread/f88de5a7bb784719/cab328a8725ee6c5

but the solution doesn't solve the issue.

Any help is much appreciated.


Looks like it might not be your code but the client library there were a few other threads on the same issue. This one has a work around, but I have not tried it myself.

The other options you have would be to upgrade to latest version (1.12 was released on Apr 11th 2011), take a look at the source and try to track down your problem, or submit an issue (it looks like the project is still actively developed).


Since the code is "stealing" entries from the feed, leaving them pointing to their parent feed (rather than copying the entries, which would create independent versions) there may be an issue with the strings cache. Try disabling the cache by commenting out -addStringsCacheToDoc in GDataXMLNode.m

0

精彩评论

暂无评论...
验证码 换一张
取 消