Я читаю файл PDF, а затем освобождаю его:
CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), (CFStringRef)@"somepdf.pdf", NULL, NULL);
CGPDFDocumentRef pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
int pagesCount = CGPDFDocumentGetNumberOfPages(pdf);
CGPDFDocumentRelease(pdf);
Но память не освобождается после освобождения (проверил это с помощью Инструментов).Зачем?Что мне не хватает в управлении памятью.
Спасибо.
РЕДАКТИРОВАТЬ
вот мой код:
- (void)loadView {
[super loadView];
CFURLRef pdfURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), (CFStringRef)@"some.pdf", NULL, NULL);
pdf = CGPDFDocumentCreateWithURL((CFURLRef)pdfURL);
CFRelease(pdfURL);
CGPDFPageRef pdfPage = CGPDFDocumentGetPage(pdf, 1);
TiledPDFView * v = [[TiledPDFView alloc] initWithFrame:self.view.bounds andScale:1];
[v setPage:pdfPage];
[self.view addSubview:v];
UIButton * but = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[but setTitle:@"removeView" forState:UIControlStateNormal];
[but addTarget:self action:@selector(tests) forControlEvents:UIControlEventTouchDown];
but.frame = CGRectMake(0, 0, 100, 40);
[self.view addSubview:but];
}
-(void) tests {
[self.view removeFromSuperview];
[self.view release];
CGPDFDocumentRelease(pdf);
}
pdf
это переменная экземпляра,TiledPDFView
- это пример из примера ZoomingPDFViewer.он рисует CGPDFPageRef
, используя CATiledLayer
.
после того, как я вызову метод tests
, представление удаляется (становится невидимым), но память, выделенная с помощью CGPDFDocumentCreateWithURL
, не освобождается.