数据格式化程序暂时不可用

发布于 2024-09-14 05:09:46 字数 252 浏览 3 评论 0原文

我的 iPad 应用程序遇到了一个问题,即我需要一次从服务器下载 10,000 多个图像。我成功下载了 8000 多张图像,但之后我遇到了类似“程序收到信号:“0”的异常。 数据格式化程序暂时不可用,将在“继续”后重试。 (加载共享库“/Developer/usr/lib/libXcodeDebuggerSupport.dylib”时发生未知错误) (gdb)”在调试器中。我测试了内存管理。内存管理没有问题。但我仍然得到了异常。请帮助我。

提前致谢, 塞卡尔·贝塔拉姆。

I had a problem with my iPad application that is, I need to download more than 10,000 images from a server at a time. I successfully downloaded more than 8000 images, But after that I got an exception like "Program received signal: “0”.
Data Formatters temporarily unavailable, will re-try after a 'continue'. (Unknown error loading shared library "/Developer/usr/lib/libXcodeDebuggerSupport.dylib")
(gdb)" this in the debugger. I tested the memory management. There are no issues in memory management. But still I got the exception. Please help me.

Thanks in advance,
Sekhar Bethalam.

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

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

发布评论

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

评论(2

彡翼 2024-09-21 05:09:46

使用数据格式化程序,以便调试器可以将对象表示为不仅仅是指针或整数值(例如,数据格式化程序允许调试器向您显示 NSNumber 的基础值,或者内部的元素NSArray 等)。有时——我不确定为什么——它们会停止工作。无论如何,数据格式化程序无法工作这一事实并不是问题的根源。

如果没有看到任何代码(例如如何下载和/或存储图像),诊断问题并不容易。在 Google 上进行一番研究后,发现 iPhone OS 上的程序在使用过多资源(不一定只是内存)时会收到信号 0。您无法阻止 iPhone 操作系统在需要时杀死您的程序。

有几个问题:

  • 您是否尝试同时或顺序下载 10,000 张图像?希望有顺序!
  • 即使您的代码中没有检测到泄漏,您的程序可能仍然使用过多的内存。您是否将这些图像的引用保存在数组或类似的内容中?
  • 你是否陷入困境?您的代码可能不会保留对任何数据/URL/图像的引用,但自动释放池可能会。在紧循环情况下,有时建议在循环开始时创建一个新的自动释放池,并在底部释放它。例如:

    for (NSUInteger i = 0; i < 10000; i++)
    {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        // 完成获取图像的工作。对象会自动添加到
        // 当前线程中最近创建的自动释放池。
        [矿池释放];
    }
    

Data formatters are used so that the debugger can represent an object as more than just a pointer or integer value (for example, data formatters allow the debugger to show you the underlying value of NSNumber, or the elements inside an NSArray, etc.). Sometimes—and I'm not sure why—they just stop working. In any case, the fact that the data formatters aren't working is not the root of the issue.

Without seeing any of your code (such as how you download and/or store the images) it is not very easy to diagnose your problem. After some digging around on Google, it appears that programs on iPhone OS receive signal 0 when they are using too many resources (not necessarily just memory). There's nothing you can do to stop iPhone OS from killing your program when it wants to.

A few questions:

  • Are you trying to download 10,000 images simultaneously or sequentially? Hopefully sequentially!
  • Even though your there are no detected leaks in your code, your program may still be using too much memory. Are you keeping references to these images in an array or something similar?
  • Are you in a tight loop? Your code may not keep references to any of the data/URLs/images, but the autorelease pool might be. In tight-loop situations, it is sometimes advisable to create a new autorelease pool at the beginning of the loop, and releasing it at the bottom. For example:

    for (NSUInteger i = 0; i < 10000; i++)
    {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        // do the work to get the image. Objects are automatically added to the
        // most recently created autorelease pool in the current thread.
        [pool release];
    }
    
抚你发端 2024-09-21 05:09:46

这是我上面提到的代码,

对于 (int i=0;i<10000;i++)
{
printf("\n 生成图像............:%d",i);
我++;

        UIImageView* imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, spotItem.imageWidth, spotItem.imageHight)];
        NSData *receivedData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://sererpath/prudently/iphone/image_s/e545afbf-4e3e-442e-92f9-a7891fc3ea9f/test.png"]];
        imageView.image = [[UIImage alloc] initWithData:receivedData] ;
        //imageView.image=[UIImage imageNamed:@"1.png"];
        [spotItem.subView addSubview:imageView];
        [imageView release];



    }

我是直接下载的。

This is my code which I mentioned above,

for (int i=0;i<10000;i++)
{
printf("\n generating images..............:%d",i);
i++;

        UIImageView* imageView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, spotItem.imageWidth, spotItem.imageHight)];
        NSData *receivedData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://sererpath/prudently/iphone/image_s/e545afbf-4e3e-442e-92f9-a7891fc3ea9f/test.png"]];
        imageView.image = [[UIImage alloc] initWithData:receivedData] ;
        //imageView.image=[UIImage imageNamed:@"1.png"];
        [spotItem.subView addSubview:imageView];
        [imageView release];



    }

I was downloading them directly.

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