Memory management for i os dev

Anton Krokhmalyuk
Anton KrokhmalyukChief Marketing Officer at e-Legion
Ошибки при работе с памятью наiOS,[object Object],Поиск причин падений в связи с “Low Memory” и EXC_BAD_ACCESS,[object Object]
Аудитория,[object Object],Разработчики,[object Object],Разработчики под iOS,[object Object]
Работа с памятью под iOS,[object Object],reference counted,[object Object],NSObject,[object Object],alloc/dealloc,[object Object],retain/release,[object Object],retainCount,[object Object]
Работа с памятью под iOS,[object Object],plane = [[Plane alloc] init];,[object Object],plane2 = [plane retain];,[object Object],plane3 = plane;,[object Object],[plane release];,[object Object],[plane2 release]; ,[object Object], [plane dealloc];,[object Object],plane,[object Object],1,[object Object],2,[object Object],0,[object Object],Plane,[object Object],plane3,[object Object],plane2,[object Object]
Ошибки при работе с памятью,[object Object],Утечки типа 1: 	ссылки удалены, объект живет,[object Object],Утечки типа 2: 	ссылки есть, объект живет (но зря),[object Object],Обращение к освобожденным объектам: 	ссылки живут, объект не живет,[object Object]
Утечки первого типа,[object Object],leakedPlane = [[Plane alloc] init];,[object Object],…,[object Object],leakedPlaner = [[Plane alloc] init];,[object Object],Plane,[object Object],leakedPlane,[object Object],Leak,[object Object],Plane,[object Object]
Утечки второго типа,[object Object],leakedPlane = [[Plane alloc] init];,[object Object],[leakedPlane retain],[object Object],[leakedPlane release],[object Object],Plane,[object Object],leakedPlane,[object Object]
Обращение к освобожденному объекту,[object Object],leakedPlane1 = [[Plane alloc] init];,[object Object],leakedPlane2 = leakedPlane1;,[object Object],[leakedPlane1 release]; leakedPlane1 = nil;,[object Object],[leakedPlane2 fly];,[object Object],Elephant,[object Object],leakedPlane1,[object Object],Plane,[object Object],BAD_ACCESS,[object Object],leakedPlane2,[object Object],Automobile,[object Object]
Low memory,[object Object],Processes,[object Object],         Name                 UUID                    Count resident pages,[object Object],      MobileMail <0798395dde43ca46317db6e674dfbbfd>    692,[object Object],     MobilePhone <82c9bd8583f4b09706a16b08e641a4b9>    489,[object Object],KingsHeroOrigins <307177e18450cdb18d466c8e7fbb23d9>  12718 (jettisoned) (active),[object Object],iPhone/iPod 1st & 2nd generation: 128 MB RAM,[object Object],Only ~20 MB for application!!!,[object Object],iPhone 3GS, iPod 3rd generation & iPad: 256 MB RAM,[object Object],~110 MB for application, but multitasking,[object Object]
EXC_BAD ACCESS,[object Object],Program received signal:  “EXC_BAD_ACCESS”,[object Object]
Что с этим делать?,[object Object],Утечки памяти первого типа (объекты без ссылок),[object Object],Instruments, Leaks,[object Object],Утечки памяти второго типа (вечные объекты),[object Object],Instruments,  ObjAlloc,[object Object],Анализ связей,[object Object],Переопределение retain/release,[object Object],EXC_BAD_ACCESS,[object Object],NSZombieEnabled (stack),[object Object],Instruments,  ObjAlloc (new XCode),[object Object],Анализ связей,[object Object],Переопределение retain/release/dealloc,[object Object]
DEMO,[object Object]
Анализ связей,[object Object],Кто владеет этим объектом?,[object Object],Карта связей,[object Object],По каким событиям он должен освобождаться? ,[object Object],Какие объекты должны освобождаться по этому событию?,[object Object]
Вопросы???,[object Object]
Контактная информация,[object Object],Станислав Краснояров,[object Object],Stanislav.Krasnoyarov@gmail.com,[object Object]
1 of 15

Recommended

Best presentation by
Best presentationBest presentation
Best presentationChan Choi
1.4K views20 slides
Hanford Waste Treatment Plant receives and sets key air-filtration equipment ... by
Hanford Waste Treatment Plant receives and sets key air-filtration equipment ...Hanford Waste Treatment Plant receives and sets key air-filtration equipment ...
Hanford Waste Treatment Plant receives and sets key air-filtration equipment ...DOE Office of River Protection
436 views3 slides
IHS McCloskey Nuclear business by
IHS McCloskey Nuclear businessIHS McCloskey Nuclear business
IHS McCloskey Nuclear businessDOE Office of River Protection
3.1K views64 slides
Hanford Waste Treatment Plant completes fifth concrete wall elevation for lar... by
Hanford Waste Treatment Plant completes fifth concrete wall elevation for lar...Hanford Waste Treatment Plant completes fifth concrete wall elevation for lar...
Hanford Waste Treatment Plant completes fifth concrete wall elevation for lar...DOE Office of River Protection
246 views3 slides
ORP 2011 Cleanup Caucus Presentation by
ORP 2011 Cleanup Caucus PresentationORP 2011 Cleanup Caucus Presentation
ORP 2011 Cleanup Caucus PresentationDOE Office of River Protection
349 views10 slides
Vamos contar by
Vamos contarVamos contar
Vamos contarMarilene Terra
547 views13 slides

More Related Content

Featured

ChatGPT and the Future of Work - Clark Boyd by
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
23.4K views69 slides
Getting into the tech field. what next by
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
5.6K views22 slides
Google's Just Not That Into You: Understanding Core Updates & Search Intent by
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
6.3K views99 slides
How to have difficult conversations by
How to have difficult conversations How to have difficult conversations
How to have difficult conversations Rajiv Jayarajah, MAppComm, ACC
4.9K views19 slides
Introduction to Data Science by
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data ScienceChristy Abraham Joy
82.2K views51 slides
Time Management & Productivity - Best Practices by
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
169.7K views42 slides

Featured(20)

ChatGPT and the Future of Work - Clark Boyd by Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd23.4K views
Getting into the tech field. what next by Tessa Mero
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero5.6K views
Google's Just Not That Into You: Understanding Core Updates & Search Intent by Lily Ray
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray6.3K views
Time Management & Productivity - Best Practices by Vit Horky
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky169.7K views
The six step guide to practical project management by MindGenius
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius36.6K views
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright... by RachelPearson36
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson3612.6K views
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present... by Applitools
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools55.5K views
12 Ways to Increase Your Influence at Work by GetSmarter
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter401.7K views
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G... by DevGAMM Conference
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference3.6K views
Barbie - Brand Strategy Presentation by Erica Santiago
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago25.1K views
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well by Saba Software
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software25.2K views
Introduction to C Programming Language by Simplilearn
Introduction to C Programming LanguageIntroduction to C Programming Language
Introduction to C Programming Language
Simplilearn8.4K views
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr... by Palo Alto Software
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
Palo Alto Software88.4K views
9 Tips for a Work-free Vacation by Weekdone.com
9 Tips for a Work-free Vacation9 Tips for a Work-free Vacation
9 Tips for a Work-free Vacation
Weekdone.com7.2K views
How to Map Your Future by SlideShop.com
How to Map Your FutureHow to Map Your Future
How to Map Your Future
SlideShop.com275.1K views

Memory management for i os dev

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.