Skip to content
This repository has been archived by the owner on Sep 16, 2022. It is now read-only.

leak in GDataXMLNode stringFromXMLString #90

Closed
GoogleCodeExporter opened this issue Apr 21, 2015 · 3 comments
Closed

leak in GDataXMLNode stringFromXMLString #90

GoogleCodeExporter opened this issue Apr 21, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link


What steps will reproduce the problem?

I have a method where I fetch GDataFeedBase 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];

  .....
 }



......


Check this link as well where users have reported of this issue:
http://markmail.org/message/6hfc43gcgl7hezu6#query%3amemory%20leak%20GDataXMLNod
e+page:1+mid:4ozoqkwthvf2mg5o+state%3aresults


What is the expected output? What do you see instead?

On using it for first time, leak doesn't occur. On subsequent calls, it starts 
leaking at GDataXMLNode stringFromXMLString

See attached screenshot.

What version of the product are you using? On what operating system?
I am using v1.9.1 gdata

Original issue reported on code.google.com by agr....@gmail.com on 29 Apr 2011 at 5:37

Attachments:

@GoogleCodeExporter
Copy link
Author

It's sorta hard to tell from this snippet here.  The page you link to, Greg 
replied that there is a cache you could be hitting.

Original comment by thoma...@gmail.com on 29 Apr 2011 at 1:48

@GoogleCodeExporter
Copy link
Author

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. The cache 
is stored in the document, which in the initial response is in the feed being 
discarded.

Try disabling the cache by commenting out -addStringsCacheToDoc in 
GDataXMLNode.m and see if that changes the leaks report.

Original comment by gregrobbins on 29 Apr 2011 at 2:05

@GoogleCodeExporter
Copy link
Author

Also, try explicitly copying the entries from the feed rather than just 
retaining them:

NSArray *entryCopies = [GDataUtilities 
arrayWithCopiesOfObjectsInArray:[feedBase entries]];
[tempFeedArray addObjectsFromArray:entryCopies];

Original comment by g...@coldnose.net on 29 Apr 2011 at 4:45

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants