"Memory is automatically controlled" - how?

I know that the biggest difference between GC and ARC is that GC is a run-time process, while ARC works at compile time. Therefore, when working with ARC, the developer must take care of memory in some scenarios.

However, according to this , there is no space left for SWFT to interact with the developer .

So how do they do it? Do they have runtime to clear memory or something else?

+4
source share
3 answers

Swift uses ARC just like Objective-C does. ARC is discussed in detail .

In short:

  • There is no garbage collector.
  • Objects live as long as (strong) links exist.
  • Strong links cannot be cyclic, otherwise you will be a memory leak. Use weak references for interrupt loops.
+5
source

I know that the biggest difference between GC and ARC is that GC

Note that ARC is a form of GC.

is runtime, while ARC works at compile time.

GC, ARC , . ARC , , , , ( ).

ARC .

. , , .

0

ARC

, , ARC . , .

, , ARC , , . , , .

, ARC , , , . , , , , .

, , , ARC , , . ARC , .

, , , , , . "" , , , .

https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AutomaticReferenceCounting.html

-1
source

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


All Articles