Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2. IOS APP MVC patternator 구조 정리 #2

Open
KangHoyong opened this issue Jul 9, 2017 · 1 comment
Open

2. IOS APP MVC patternator 구조 정리 #2

KangHoyong opened this issue Jul 9, 2017 · 1 comment
Assignees

Comments

@KangHoyong
Copy link
Owner

KangHoyong commented Jul 9, 2017

ios study 2day (Light the candle) MVC patternator

2017-07-05 3 32 03

@KangHoyong KangHoyong changed the title 2. IOS APP 2. IOS APP MVC patternator 구조 정리 Jul 9, 2017
@KangHoyong KangHoyong self-assigned this Jul 9, 2017
@KangHoyong
Copy link
Owner Author

KangHoyong commented Jul 9, 2017

__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을 가지는 것을 확인할수있다.
2017-07-09 1 55 58

__unsafe_unretained 사용한 경우 return 후에 메모리가 자동적으로 nill을 가지지 않는다.
2017-07-09 1 58 37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant