Comments (1)
__strong & __weak 차이점
__strong : 만들어진 아이를 강하게 가지고 있다가 함수의 지역성에 의해서 if문 끝나고 stack pop 되면 메모리 삭제
ex) __strong UIImage *temp = [[UIImage alloc] init]; life cycle 관여를 합니다 강하게 참여하여 함수의 지역성에 의해서 if문 끝나고 stack pop 되면 메모리 삭제
__weak : weak 단순참조 객체가 필요해서 포인터를 객체를 가저오는경우 주소는 있는데 내가 원하는객체가 없으면 댕글링 포인터(포인터가 여전히 해제된 메모리 영역을 가리키고 있다면, 이러한 포인터를 댕글링 포인터(Dangling Pointer)라고 한다)가 발생 하지만 Zero weak 발생하여 댕글링 포인터 해결 즉 if문이 끝나면 stack pop 대상지의 주소가 없으므로 NULL처리
__unsafe_unretained : Zero weak 발생하지 않는다. if문이 끝나도 메모리는 살아있음
__weak 사용한 경우 return 후에 메모리가 자동적으로 nill을 가지는 것을 확인할수있다.
__unsafe_unretained 사용한 경우 return 후에 메모리가 자동적으로 nill을 가지지 않는다.
from studyroom.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from studyroom.