How important is memory management in Objective-C?

Background: I (jumping onto the bandwagon and), starting to learn about the development of the iPhone / iPad and Objective-C. I have a lot of experience in web development, and most of my programs run in javascript (without libraries), Ruby and PHP.

Question: I will learn about memory allocation and release in Objective-C, and I find it quite a challenge for a layer on top of the actual run farking. I am trying to get an idea of ​​the applications that are and what will happen to a bad memory driven program.

A) Are applications usually released without memory leaks? Is this a possible goal, or do people more realistically just excise the worst criminals and is this normal?

B) If I create a NSStringview for the title, say, and forget to free it, is it really a problem only if I re-create this line again? I imagine what I am doing, creating the overhead of the memory needed to store this line, so it is probably quite confused (a few bytes?) However, if I have a loop cycle in the game, which β€œleaks” int every cycle or something that would quickly overwhelm the application. Are these assumptions correct?

Sorry if this is not a crossroads of the wiki community, I'm just trying to figure out how to think about memory and how carefully I need to be. Any jokes or App-apps presented in the app would be great to hear as well.

+3
source share
5 answers

Follow the patterns, and memory management is rarely the biggest hurdle in Cocoa.

: . NSString, -, . , , (, , ). , , . (, , ) : Apple iPhone OS, "" , .

, , .

+4

Cocoa, - , ( - C). , Cocoa , Cocoa.

, . .

+5

.

: , . - , . . . , , .

: .

+3

. Apple , Instruments.

bean: XCode

+1

Source: https://habr.com/ru/post/1748703/


All Articles