Here's the ULTIMATE tip to find memory leaks in Xcode!

preview_player
Показать описание
#iOS #swift #softwaredeveloper #iosdeveloper

Thank you for watching this video 🙌

Рекомендации по теме
Комментарии
Автор

Did you find this tip useful? Are you already using it in your apps? Let me know in the comments 🚀

v_pradeilles
Автор

Yup it's useful. What I do to look for memory leaks is, instead of launching Instruments, I pause the app with the memory debugger and look at the number of instances for each class, not just the view controllers. It's easy to spot when there are more than expected. Sometimes the expectation may be wrong and there is a good reason for some instances to be alive, so it also helps me understand what the app does in case I've forgotten of some design decision.

poluxsaurus
Автор

I always put a log statement in the deinit of all my ViewControllers and ViewModels and any other classes that shouldn't be hanging around. For example, there is one scenario for an app I work in that pushes about 5 screens deep and then on the final screen there is a button to pop to root, so I check that I see logs for the deinit of all 5 of those screens and corresponding view models. It would be difficult to listen out for 10 different bloops and find the offending class if there was less than 10 bloops lol.

mistymu
Автор

Similarly I usually will have base classes (BaseViewController that contains common items) and will have dealloc (objc) or deinit (swift) methods and just wrap a print statement saying self.description + “ deallocated” in an if debug check. It helps if you’re a breakpoint hoarder like myself. 😂

michaelbrown
Автор

There would be dancing music if we put symbolic breakpoint in a call where multiple instances are created and only few of them are released

vaibhavbansod
Автор

Thanks, i use this breakpoint as well except instead of sound I use the action log message to consol with "--- dealloc @(id)[$arg1 description]@ @(id)[$arg1 title]@"

byaruhaf
Автор

another interesting feature I learned from you, thanks💥

mykytakhlamov
Автор

what about Model & ViewModel classes? can we monitor dealloc for those custom classes?

rasheshbosamiya
Автор

In very big code how we identify which object is cause of memory leak. Is thr any way to find it?

shilpagade
Автор

This trick always amazes me, great video!
Is it possible to do something similar for SwiftUI? I guess everything is a View so it might be hard (and loud 😂)

marekszymanski
Автор

This is not my choice. Because the problem is with all the references and you only understand the controls. Of course, the sound is not good and can be printed with the following code, which shows its efficiency in deleting several pages at the same time. . in symbol : use the action log message to consol with "--- dealloc @(id)[$arg1 description]@ @(id)[$arg1 title]@"

mohammadmnasrabadi
Автор

Why that clousure make a memory leak? I know that there is no weak self but I dont get the point why that happens :( thanks

AnLaXGaminG
Автор

it's waste of time for 2 reasons: too hard to understand and it doesn't always work well.

alexeykhomych