Swift 메모리애 대해 알려줘
Generated on 8/22/2024
1 search
Swift의 메모리 관리에 대해 설명하겠습니다. Swift는 메모리 할당 시 공유 소유권을 가지는 경우가 많습니다. 이는 동일한 메모리에 대해 여러 독립적인 참조가 존재한다는 것을 의미합니다. Swift는 이러한 할당의 수명을 참조 카운팅(reference counting)으로 관리합니다. 참조 카운트를 증가시키는 것을 'retain', 감소시키는 것을 'release'라고 합니다.
Swift에서 메모리를 사용하는 방법은 메모리 레이아웃(memory layout)이라고 부릅니다. Swift에서 값을 논할 때, 우리는 보통 메모리에 무엇이 저장되어 있는지와는 상관없이 높은 수준의 개념을 이야기합니다. 예를 들어, 초기화 후에 이 변수의 값이 두 개의 더블로 이루어진 배열이라고 말할 수 있습니다. 메모리에서의 표현을 논할 때는 '값'이라는 단어 대신 '표현(representation)'이라는 기술적인 용어를 사용합니다.
이와 관련된 자세한 내용은 Explore Swift performance (10:13) 세션에서 확인할 수 있습니다.
Migrate your app to Swift 6
Experience Swift 6 migration in action as we update an existing sample app. Learn how to migrate incrementally, module by module, and how the compiler helps you identify code that’s at risk of data races. Discover different techniques for ensuring clear isolation boundaries and eliminating concurrent access to shared mutable state.
Create a custom data store with SwiftData
Combine the power of SwiftData’s expressive, declarative modeling API with your own persistence backend. Learn how to build a custom data store and explore how to progressively add persistence features in your app. To get the most out of this session, watch “Meet SwiftData” and “Model your schema with SwiftData” from WWDC23.
Track model changes with SwiftData history
Reveal the history of your model’s changes with SwiftData! Use the history API to understand when data store changes occurred, and learn how to use this information to build features like remote server sync and out-of-process change handing in your app. We’ll also cover how you can build support for the history API into a custom data store.
Explore Swift performance
Discover how Swift balances abstraction and performance. Learn what elements of performance to consider and how the Swift optimizer affects them. Explore the different features of Swift and how they’re implemented to further understand the tradeoffs available that can impact performance.
Platforms State of the Union 5-Minute Recap
Watch a quick recap of the newest advancements on Apple platforms.
What’s new in SwiftData
SwiftData makes it easy to add persistence to your app with its expressive, declarative API. Learn about refinements to SwiftData, including compound uniqueness constraints, faster queries with #Index, queries in Xcode previews, and rich predicate expressions. Join us to explore how you can use all of these features to express richer models and improve performance in your app. To discover how to build a custom data store or use the history API in SwiftData, watch “Create a custom data store with SwiftData” and “Track model changes with SwiftData history”.