Memory Leaks in iOS: Find, Diagnose, & Fix (2022)
HTML-код
- Опубликовано: 6 мар 2022
- In this video we will cover memory leaks in iOS apps. We will first do an example to leak some memory and then fix it. More interestingly, we will explore the Leaks Instrument to visualize leaks/memory addresses. Will additionally cover the visual memory object graph. We will work in Xcode 13.
💻 Source Code: / iosacademy
🎥 Subscribe for more: ruclips.net/user/iOSAcademy?su...
😎 Like my teaching style? Check out some of my most popular courses! courses.iosacademy.io
👉🏼 Connect (personal LinkedIn) / afraz-siddiqui
🚀 Follow on LinkedIn / ios-academy
** Popular Series
Building Instagram: courses.iosacademy.io/p/build...
Building TikTok: / @iosacademy
SwiftUI for Beginners: ios-academy.teachable.com/p/s...
** Get Skillshare free for 2 Months and learn iOS
www.skillshare.com/r/user/afraz
** Manage all your investments from app earnings on Betterment!
bit.ly/3eBwlI9
** Grow your own RUclips tech channel with TubeBuddy:
www.tubebuddy.com/iosacademy
#swift #memory #debugging
Into iOS? Lets connect! linkedin.com/in/afrazsiddiqui
Excelent vídeo as always! One question: What is the difference between declaring the vc variable as weak to passing a weak self on to it from secondVC?
A more in-depth discussion of Instruments specifically to debug memory leaks would be very helpful. I have a personal App I'm working on and I'm definitely retaining memory somewhere. It'd be nice to figure out what is going on and how to use Instruments.
On my list!
Finally something that makes sense, everybody used to just give definations from google and vague answers to this question, this is such an important and vast topic, now i know what to look for, Thanks man, I repect you !
top, like always, although I think I knew most, it's nice to see it come together like this for the community. Well done!
Thanks
That's good 👍 need more videos in depth for expert debugging and finding memory leaks
More in-depth coverage as well as how to cure these in SwiftUI would be very much appreciated! Great start and exposure to something that I have explored but not really focused on enough. Thanks!
Thank you so much. I was looking for this topic for long times. Best Regards...
You’re welcome
Thanks a lot Afraz. It was a great topic with great explanation. Again you are the best. Please make some iOS debugging videos , tracing threads , understand how and where to fix and find out step by steps break points explanation. This memory leaks video covered one of them . Thanks a lot . You are doing fantastic. Good luck to you and your channel.
Thank you!
loved this !
Thanks
I was asked this during an interview with THE big guy. Thanks for the coverage man
You’re welcome
👍👍👍👍👍 for more videos about this topic. Mostly to detect more complex leaks
You’re welcome
Thank you so much for the video. Please make more videos on memory leaks.
You’re welcome
Thanks a lot. that was a great and important topic. great cover. my request from you is that can you make a video about searching word from string. searching a word from textView's or SwiftUI's TextEditor's text and highlight matched ones. Like we do CMD+F? or can you guide me to it?
Great video, as always! Would you be willing to make the following videos please?
1. Show how to implement a loading animation that shows how many photos have been retrieved from Firebase Firestore and how many are remaining (like you see with Egnyte, for example).
2. Ask user for permission to access things such as Contacts, Photo Library, Location, and their Files.
Thank you for your hard work!!
Thanks
Welcome
I am learning so much in tutorial iOS academy, thank you
Glad to hear that!
To avoid buggy false-positives in Instruments, run on an actual device instead of the simulator.
Yup, the simulator is kind of annoying sometimes
Awsome
Thanks
I like your videos and i have subscribed your channel. Please make different videos for each and every feature in Instruments. Like., "Time Profiler" , "Leaks", "Allocations", "Network", "Core Data" and so on..
Thanks
Nice video, but please show how to resolve memory leaks using Instruments. Thanks
Another video that's more in depth with a potentially real-world situation would be helpful!
I created a little extension method that runs shortly after viewDidDisappear that checks if the VC still has a parent and/or a presentedViewController. If both are nil it's most probably a leak and shows you a warning (popup in debug builds) and sends a log to Crashlytics (release builds).
Great
I just finished a package named LeakedViewControllerDetector that does what I described.
how do you find a leak from a closure that's executed on the background thread?
My memory graph doesnt show labels like yours. Its just few shapes with arrows but no labels. How can I see label below each shape?
if i am not mistaken instrument did not show memory leak of custom view, did it? there were some leaks but not related to MyView instance. The reason am interested in this video I am currently investigating my project and believe there are leaks. For one of my class deinit is not called. so i tried to figure out by using instruments/leaks. However it does not show me any leaks. really strange.
Same for me Xcode 14.2
@@iJigarThakkar I have investigated a project with plenty of leak since weak self is missing in every single closure. You know what, Xcode 14.1 caught no of them absolutely. What is that?..
@@shurale85 I think there is something with either Swift 5.7 or Xcode 14, I can’t a lot to create retain cycle at all
Same problem, it doesn't show memory leaks at all. I am tired of looking for a solution. Xcode 14.3
I prefer to implement deinit and print out. If no debug output it’s leak.
Thats helpful too
One might use weak everywhere to escape leaks being not sure if it is worth to use it. I guess there are limitations, constrations and disadvantages of using weak. Can you please tell me what they are?
I have a dedicated video on this
Hello, I always watch your video.
I just want to ask for a fix or any workaround about the memory leaks in google maps sdk in ios.
I can't find any working solution.
Unfortunately you cannot easily fix a leak in someone else’s code
@@iOSAcademy I see. So it is on google map sdk side? What I did is I stop the updating(CLLocationManager) after the first load, and then when saving I start again to update at the back so I can have the newest and current location.
If you have a better workaround, will gladly appreciate it.
Anyways, thank you very much for your reply. Really appreciate it. Keep up!
Hi,
Can you also make Swift 5.5 course please?
Sure
@@iOSAcademy thank you.
I like the way you explain things.
I am ready to purchase this new course, looking forward to it.
Wait…memory leaks? I thought Swift handled memory automatically??
How to diagnose memory leak flutter module integrate in native app ?
Flutter memory profiling requires some external flutter tooling
Thanks
Youre welcome