2

PDFファイルでこの簡単なコードを実行する

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application

    NSURL *url = [NSURL fileURLWithPath: @"/Users/pc/Desktop/C# 4.0 in a Nutshell The Definitive Reference.pdf"];
    PDFDocument *document = [[PDFDocument alloc] initWithURL:url];
    [document release];

}

そしてそれをインストゥルメントで実行すると、次のようにメモリリークが発生します

ここに画像の説明を入力

少し調査したところ、一部の PDF ファイルでのみ発生することがわかりました。その他のファイルは、Instrument でリーク警告なしで実行されます。

これは PDFKit のバグですか?

アップデート

このコードを数回実行すると、メモリが真剣に上がります

-(IBAction) test: (id) sender
{
    NSLog(@"Starting");
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    NSURL *url = [NSURL fileURLWithPath: @"/Users/pc/Desktop/C# 4.0 in a Nutshell The Definitive Reference.pdf"];

    for (int i=0; i<100; i++)
    {
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        PDFDocument *document = [[PDFDocument alloc] initWithURL:url];
        [document release];
        [pool release];
    }

    [pool release];


}
4

1 に答える 1

2

PDFを開くたびにリーク量が増える?その場合は、https: //bugreport.apple.com/ でレーダー経由でバグを報告することをお勧めします。

PDF をいくつ開いても金額が変わらない場合は、おそらくバグではありません。

于 2012-01-07T17:17:36.200 に答える