Memory Leak

Issue #250 on hold
ShareLJM created an issue

ABC7F30B-2B61-4204-8571-C38AF5472D0B.pngIn the ObjectC project, when I use the method of"imebra:: DataSet:: getImageAppleModalityTransfirm", there was a memory leak, and then I located it at the bottom of the stack caused by " imebra:: implementation:: memoryPoll:: getMemory".

Comments (5)

  1. Paolo Brandoli repo owner

    Imebra has a configurable memory cache that hold some of the de-allocated memory for faster allocation when processing images with the same size.

    I should see the code of the client app before considering this as a bug.

  2. ShareLJM reporter

    NSString filePath = [[NSBundle mainBundle]pathForResource:@"MRBRAIN" ofType:@"DCM"]; ImebraDataSet dataSet = [ImebraCodecFactory loadFromFile:filePath error:nil]; // 获取帧数 ImebraTagId *tagId = [[ImebraTagId alloc] initWithId:ImebraTagNumberOfFrames_0028_0008]; NSUInteger dataSetPage = [dataSet getSignedLong:tagId elementNumber:0 error:nil]; NSLog(@"%lu",(unsigned long)dataSetPage);

    self.resultArr = [[NSMutableArray alloc] init];
    NSError *appleError;
    for (int i =0; i<dataSetPage; i++) {
        @autoreleasepool {
            ImebraImage *image =  [dataSet getImageApplyModalityTransform:i error:&appleError];
            if (appleError) {
                NSLog(@"%u",i);
                break;
            }
            NSString *colorSpace = image.colorSpace;
            uint32_t width = image.width;
            uint32_t height = image.height;
            ImebraTransformsChain *chain =[DicomUtils applyTransformationColorSpace:colorSpace dataSet:dataSet image:image width:width height:height];
            UIImage *img = [DicomUtils generateImage:chain withImage:image];
            [_resultArr addObject:img];
        }
    }
    
  3. Log in to comment