Find View in View Hierachi

Memory usage graph

Memory leak debug with Xcode Instruments

What is Xcode Instruments?

Xcode Instruments is best described as a powerful and flexible performance-analysis and testing tool. It’s part of the Xcode toolset which also includes tools like Create ML and the Accessibility Inspector.

The instruments can be used to:
Track down problems in your source code
Analyze the performance of your app
Find memory problems
And a lot more!

Main Thread Checker in Xcode

How to enable Main Thread Checker ?
Edit scheme.
Select run scheme.
Select the Diagnostics tab.
Check the Main Thread Checker Check Box.
Click on small arrow written besides MTC text (Optional).
On click on arrow message besides main thread checker will add breakpoint for the project for debugging.

debug-thread-ios-2

debug-thread-ios-1

debug-tool-xcode-3

How does this function works ?

During runtime it will check if all UI and other code which should be run in main thread is working or not, incase it is not working it will pause at the line of code which should be put in main thread along with appropriate warning message.

debug-thread-ios-4

If main thread debugger break point is not added and one wish to identify issues without that then you can get a look at the list of all the main thread issues in runtime error messages.

debug-thread-ios-5

References

Xcode Instruments usage to improve app performance

https://www.hackingwithswift.com/read/9/4/back-to-the-main-thread-dispatchqueuemain

About the Author

Super Kal

View all author's posts

Bài viết khác

Flutter Form

FLUTTER FORM LÀ GÌ? Form trong Flutter là widget dùng để thu thập và kiểm tra dữ liệu người dùng nhập vào. Thường dùng khi cần nhập nhiều trường và muốn kiểm tra tính hợp lệ của dữ liệu. Sự khác nhau giữa Form + TextFormField và TextField thông thường TextField là widget đơn lẻ, […]

Flutter State Management

State Management trong Flutter là quá trình quản lý và thay đổi trạng thái của widget. Khi state thay đổi, widget sẽ được cập nhật lại để phản ánh thay đổi đó. Có nhiều phương pháp quản lý state trong Flutter, mỗi phương pháp phù hợp với các loại ứng dụng khác nhau.   Các […]

Flutter Layout

Flutter Layout là gì ? Trong Flutter, layout là quá trình sắp xếp các widget con trong không gian giao diện người dùng. Flutter cung cấp nhiều widget layout giúp xây dựng giao diện ứng dụng linh hoạt và dễ dàng. Việc sử dụng đúng các widget layout sẽ giúp bạn tạo ra giao diện […]

Flutter Widget

FLUTTER WIDGET LÀ GÌ? Widget là “viên gạch” để xây nên giao diện Flutter. Mọi thứ nhìn thấy trên app đều là widget: chữ, nút bấm, ô nhập liệu, hình ảnh… Phân loại cơ bản Widget 1. StatelessWidget – Giao diện tĩnh Không thay đổi sau khi được tạo. Dùng khi widget chỉ hiển thị thông tin, […]

Flutter Package

Trong quá trình phát triển ứng dụng Flutter, để tiết kiệm thời gian và tái sử dụng các tính năng có sẵn, lập trình viên thường sử dụng Flutter package – là các thư viện (thư viện mã nguồn mở hoặc do cá nhân viết) giúp thêm các chức năng mới vào ứng dụng mà […]

Agile – Phương pháp phát triển phần mềm linh hoạt

Agile là gì? Agile là một phương pháp phát triển phần mềm linh hoạt, nhấn mạnh vào khả năng thích nghi với thay đổi, làm việc theo nhóm, và phát triển sản phẩm theo từng phần nhỏ (iterative & incremental). Agile không phải là một quy trình cụ thể, mà là một tư duy (mindset) […]