GData Objective C 客户端内存泄漏

发布于 2024-11-04 06:11:27 字数 1805 浏览 2 评论 0原文

我有一个方法,可以获取 GDataFeedBase 条目并将它们作为数组返回到另一个函数

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;

.....

我有另一个函数,可以从 tempFeedArray 对象(即 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];

  .....
 }



......

第一次一切正常。但下一次,它显示内存泄漏 GDataXMLNode stringFromXMLString:

还有其他人遇到过这个问题吗?

我在 gdata 开发者论坛中发现了类似的问题: http://groups.google.com/group/gdata-objectivec-client/browse_thread/thread/f88de5a7bb784719/cab328a8725ee6c5

但该解决方案并不能解决问题。

非常感谢任何帮助。

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];

  .....
 }



......

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

深爱成瘾 2024-11-11 06:11:27

看起来这可能不是您的代码,而是客户端库有一些关于同一问题的其他线程。 一种解决方法,但我自己还没有尝试过。

您可以选择的其他选项是升级到最新版本(1.12 于 2011 年 4 月 11 日发布),请查看 source 并尝试查找您的问题,或提交 问题(看起来该项目仍在积极开发中)。

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).

你的他你的她 2024-11-11 06:11:27

由于代码从提要中“窃取”条目,让它们指向其父提要(而不是复制条目,这会创建独立版本),因此字符串缓存可能存在问题。尝试通过注释掉 GDataXMLNode.m 中的 -addStringsCacheToDoc 来禁用缓存

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文