#iOS #swift #softwaredeveloper #iosdeveloper Thank you for watching this video 🙌 ➜ Leave a tip: www.buymeacoff... ➜ Website: www.swiftwithv... ➜ Twitter: / v_pradeilles ➜ GitHub: github.com/vin... ➜ LinkedIn: / vincentpradeilles
Пікірлер: 33
@v_pradeilles2 жыл бұрын
Did you find this tip useful? Are you already using it in your apps? Let me know in the comments 🚀
@poluxsaurus14542 жыл бұрын
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.
@jack666hack2 жыл бұрын
This could work for a small app but big ass app is a headache
@mistymu81542 жыл бұрын
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.
@michaelbrown2 жыл бұрын
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. 😂
@shalinibhat23392 жыл бұрын
Thank you for this amazing video
@natgenesis50382 ай бұрын
Thanks so much
@vaibhavbansod35285 ай бұрын
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
@mykytakhlamov Жыл бұрын
another interesting feature I learned from you, thanks💥
@bravehearted1010 Жыл бұрын
Very useful tip. Thanks a lot!
@jack666hack2 жыл бұрын
Love the tutorials buddy 🔥
@byaruhaf2 жыл бұрын
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]@"
@richardrubin2192 Жыл бұрын
Merci, Vincent! Great tip!
@shilpagade19132 жыл бұрын
In very big code how we identify which object is cause of memory leak. Is thr any way to find it?
@rasheshbosamiya14822 жыл бұрын
what about Model & ViewModel classes? can we monitor dealloc for those custom classes?
@rasheshbosamiya14822 жыл бұрын
@hydro1337x thank you for reply, I have tested and it works with custom classes (e.g. Model, ViewModel etc)
@alexcupra96822 жыл бұрын
Amazing trick! Thanks :)
@Jaroshevskii Жыл бұрын
You amazing, thanks very much ☺️
@Mani-xx4fz2 жыл бұрын
Nice trick! Thx 👌
@mohammadmnasrabadi68372 жыл бұрын
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]@"
@alexandergavrilov80192 жыл бұрын
great!
@rahuljamba5846 Жыл бұрын
Great man
@AnLaXGaminG2 жыл бұрын
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
@addisonfrancisco90072 жыл бұрын
The closure is causing an increase to the reference count because it is capturing self. So, ARC is not going to clean up that view controller during dealloc because the ref count is greater than 0. You can read more about it here under “Strong Reference Cycles for Closures” docs.swift.org/swift-book/LanguageGuide/AutomaticReferenceCounting.html
@abymathew5752 жыл бұрын
kzbin.info/www/bejne/fXrcXqSkfLGjfrc I think this video will give your more details about it. Please check this
@marekszymanski23752 жыл бұрын
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 😂)
@mistymu81542 жыл бұрын
SwiftUI views are structs so they won't have a retain cycle. You should keep an eye on view models though.
@user-jl8xe2df4d Жыл бұрын
Just like in WWDC
@followerOfJesus723 Жыл бұрын
This is so not working.
@KarenJohnson-m8o8 күн бұрын
Taylor Eric Hall Amy Jones Paul
@rickywitherspoon28612 жыл бұрын
🤯
@alexeykhomych17432 жыл бұрын
it's waste of time for 2 reasons: too hard to understand and it doesn't always work well.