All Questions
Tagged with automatic-ref-counting memory
92 questions
0
votes
0
answers
80
views
Swift: Ensuring deinitialization of objects in arrary
I'm new to Swift's ARC and I'm having a possibly memory problem with the following swift code:
class Device {
let name: String
var ports: [Port]
init(name: String, ports: [Port] = []) {
...
0
votes
1
answer
409
views
Weakly captured self won't let the view model deallocate until the Task finishes
I am trying to learn ARC and I'm having a hard time with a weakly captured self. My project is using MVVM with SwiftUI. I'm presenting a sheet (AuthenticationLoginView) that has a @StateObject var ...
9
votes
2
answers
1k
views
UIViewController with CFNotificationCenter strong reference won't release
I have a view controller that is never released once its parent view controller is removed from the view hierarchy and released. Every instance of it within the memory graph looks the same in that it ...
1
vote
1
answer
823
views
Memory continuously increasing on swift application
I'm coding a generic Swift application (not for iOS, it will later run on raspbian) and i noticed a constant increase of memory. I checked for memory leaks also with the inspector, and there are none.
...
1
vote
1
answer
196
views
Swift Memory Deinit During Reassignment
Let's say I have a custom CIImage class.
import UIKit
class MyCIImage: CIImage {
var VC:RealtimeDepthMaskViewController!
deinit { print("Deinit") }
override init(cvPixelBuffer ...
0
votes
0
answers
36
views
Every initialized PDFDocument (in loop iteration) stays in memory until loop finishes. What can I do about that?
I asked a similar question yesterday. There, the problem lied in the managedObjectContext (Swift - Read many big files from FileManager and save them as NSData in CoreData (every file is somehow kept ...
6
votes
1
answer
1k
views
SpriteKit not deallocating all used memory
I have ready many (if not all) articles on SO and other sites about the disasters of dealing with SpriteKit and memory issues. My problem, as many others have had, is after i leave my SpriteKit scene ...
0
votes
1
answer
367
views
NSKeyedArchiver archivedDataWithRootObject: not release memory useage
Code like this:
NSMutableData *data = [NSMutableData dataWithLength:10*1024*1024];
for (int i = 0; i < 10; i++) {
NSData* archiveData = [NSKeyedArchiver archivedDataWithRootObject:data];
...
3
votes
0
answers
92
views
Memory Leaks Issue in Protocol involving Mirror
I wrote this protocol so that I could create a struct and convert it by accessing this method:
protocol JSONConvertable {
func toAnyObject() -> Dictionary<String, Any>
}
extension ...
1
vote
1
answer
227
views
Strange ARC Memory Release Issue
I have an application under development and I am struggling to understand why Xcode appears to be telling me it is holding on to (what seems) almost everything created, causing some memory pressure ...
1
vote
0
answers
721
views
Swift memory will not release
I have a class that get all the user assets, get the image and then perform face detection on each of the images. I am calling my class from the viewDidLoad function like this:
override func ...
3
votes
4
answers
1k
views
Objects released too soon while in a background thread
I'm trying to build an array of dictionaries in a background thread while keeping access to the current array until the background operation is done. Here's a simplified version of my code:
@property ...
1
vote
2
answers
2k
views
How to remove MKMapView in memory?
run a mapview in xcode waste too much memory, so that i want to remove the mapview when current ViewController dismiss:
deinit{
mapView = nil
}
but in the debug navigator, memory didnt release ...
1
vote
1
answer
1k
views
Create Unmanaged<CFString> from Swift
Since Swift 2, C functions that take C callbacks can be invoked from Swift without an intermediate wrapper.
Many C event handling APIs follow the pattern that you first create a context:
struct ...
0
votes
1
answer
553
views
Why the UIImage is not released by ARC when I used UIGraphicsGetImageFromCurrentImageContext inside of a block
I try to download an image from server by using the NSURLSessionDownloadTask(iOS 7 API), and inside of the completion block, I want to the original image to be resized and store locally. So I wrote ...