iOS App: Terminated due to memory issue [Related to swiftSlowAlloc or UIImage]
<p>Currently I am facing a memory issue problem in building iOS app. I checked for Memory leaks using Instruments. I found that there is one kind of leaks that keeps on showing up named swift_slowAlloc, which I don't have idea about. An snippet of the error is given below. </p>

<p><a href="https://i.stack.imgur.com/JBe1r.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/JBe1r.jpg" alt="Memory Leaks"></a></p>

<p>Another reason I think could happen is due to loading of several UIImages in my app. Just to provide a background, I take various portions of an original image in my app and do some processing on them. However, I don't need to keep the images for further calculations. I used autoreleasepool to release the UIImage; but I doubt that it is working. An example is given below:</p>

<pre><code>   @autoreleasepool {

        UIImage *imageResized = MatToUIImage(resized28);

        // MARK: Send resized28 to CNN and get the output. Fill the dict then

        NSString *CNNScore;
        CNNScore = [myclass CNNfloat:imageResized W1:W1 W2:W2 Wf1:Wf1 Wf2:Wf2 B1:B1 B2:B2 Bf1:Bf1 Bf2:Bf2];

        imageResized = nil;
        xtn = [NSNumber numberWithInteger:xt];
        xbn = [NSNumber numberWithInteger:xb];
        ytn = [NSNumber numberWithInteger:yt];
        ybn = [NSNumber numberWithInteger:yb];

        symbol = [NSString stringWithFormat:@"%@", CNNScore];
        symtype = [NSString stringWithFormat:@"%@", [scoreDic objectForKey: symbol]];

        numberInDict = [NSString stringWithFormat:@"%i", n];


        inToMaroof = [NSArray arrayWithObjects: xtn, xbn, ytn, ybn, symbol,symtype, nil];

        [toMaroof setObject: inToMaroof
                     forKey: numberInDict];
        }
    }
</code></pre>

<p>Can someone suggest anything on this issue?</p>