All Questions
283 questions
1
vote
1
answer
40
views
Why is a CALayer retained after I stop referencing it?
I've the impression that my CALayer is retained after being added as a sublayer until the end execution block, instead of until I stop referencing it.
The parent UIView is however released as soon as ...
1
vote
0
answers
27
views
Memory allocation in swift [duplicate]
In swift, based on Apple's documentation reference types are stored on heap and value types on stack, but if a class definition has a struct variable for example String, where will that be stored?
...
0
votes
1
answer
142
views
ARC and pointer storing
My situation is a bit more complex than what I've seen here before posting, and I'm not really good with memory management.
I have a custom UITableViewCell (that we will call MyCell here) and I pass ...
2
votes
1
answer
39
views
Some residue memory never released with ARC?
I have done my best to make sure that views are released when they are no longer needed and when pushing the app and then looking at the Debug Memory Graph I see that no objects are present that ...
1
vote
1
answer
2k
views
Should I use `weak self` when making asynchronous network request?
Here is my method to fetch some data from the network:
func fetchProducts(parameters: [String: Any],
success: @escaping ([Product]) -> Void)
As you noticed, it has escaping ...
0
votes
1
answer
360
views
What happens when an object tries to access deallocated unowned object?
if A is declared as unowned var and is then deallocated, What happens when another object tries to access A?
0
votes
0
answers
64
views
iOS: ViewController kept by reference
I have a viewcontroller A where I add views of other viewcontrollers dynamicaller to A's subView. For efficiency reason I keep those viewcontrollers in a dictionary and remove/add their views ...
2
votes
2
answers
2k
views
Allowing a completion handler to outlive the local scope where it's created
I have a class that implements the XMLParserDelegate protocol and during initialisation it gets a string and a completion handler as the arguments. I'm trying to call completion handler after parsing ...
2
votes
3
answers
310
views
How does ARC work in loops? [closed]
I search a lot of information but couldn't find anything. Maybe I can't search well) As I know ARC work like compile tool. This tool actually instead of developer sets release and retains in assembler ...
4
votes
1
answer
189
views
Why does returning a __strong and __autoreleasing variable yields different object lifecycle only after the first time?
Consider this piece of code:
@implementation MyClass
-(void)dealloc {
NSLog(@"MyClass dealloc: %@", self);
}
@end
@implementation AppDelegate
__weak static MyClass *weakShared = nil;
- (...
0
votes
0
answers
25
views
How to release viewControllers that has been launched and killed several times during the day?
I try to kill some views with that code (and the same on the other way with the other view):
NSMutableArray *vcArray = [[NSMutableArray alloc] initWithArray: self.navigationController....
1
vote
1
answer
76
views
Capture semantics when assigning a function to a block in Swift?
I'm wondering about what it means when you assign a function to a block in Swift in terms of memory management (i.e. I want to avoid a retain cycle).
For example, say I have a button with the ...
1
vote
1
answer
111
views
memory management issues in xamarin.ios
As far as I have worked in xamarin declaring global variables in view controller is very important or else it can be garbage collected when it comes to Binding and all concerned.
likewise for ...
2
votes
1
answer
256
views
how the garbage collection and reference count works hand in hand in Xamarin
Xamarin has it own memory management tool called Garbage Collector as it uses C#.
When we develop iOS application reference count comes into picture.
I really couldn't understand on how these two ...
0
votes
1
answer
403
views
Ios memory management comes out so confused: CFGetRetainCount()
In ARC environment, I allocate a dynamic array of which each element is a pointer to NSObject*. Then use CFGetRetainCount to get the retain count of the NSObject. The result comes out as expected. ...