Xcode for iOS 项目中的动态分析器和静态分析器有什么区别?
我发现静态分析器意味着使用 xcode 来运行分析器。那么动态分析仪是什么意思呢?如何使用它?
I found that static analyzer means run with analyzer using xcode. Then what does dynamic analyzer mean? How to use that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
静态分析可以看作是由高级编译器进行的更严格的语法检查(不会产生二进制代码,但会产生错误消息)。
动态分析是在程序实际运行时进行的具体分析。在运行时进行的分析可以检测特定的行为,例如访问已释放的内存、泄漏内存、函数所花费的时间等等。
粗略地说,静态分析是高级编译,动态分析是一种特殊的测试形式,通常需要对程序进行“检测”(即在二进制级别进行修改)。
在 Xcode 中,可以通过 Instruments 进行动态分析。您可以通过谷歌搜索“xcode 仪器教程"。
简而言之,您可以在动态分析下运行您的程序,选择“使用性能工具运行”并选择您想要执行的分析类型(内存泄漏、内存分配、性能、僵尸等)。仪器将在图形环境中向您显示内存使用情况如何变化,或者执行特定功能需要多长时间等。
Static analysis can be seen as a stricter check of syntax made by an advanced compiler (that will not produce binary code but error messages).
Dynamic analysis is a specific analysis done when the program is actually running. Thins kind of analysis, being done at runtime, can detect specific behaviors, like accessing deallocated memory, leaking memory, time spent in functions and so on.
To put it roughly, is static analysis is advanced compilation, dynamic analysis is a particular form of testing that often requires your program to be "instrumented" for it (i.e., modified at the binary level).
In Xcode, dynamic analysis is available through Instruments. You can found more information about it by googling for "xcode instruments tutorial".
In short, you can run your program under dynamic analysis choosing "Running with Performance Tool" and choosing the kind of analysis you want to perform (memory leaks, memory allocation, performance, zombies, etc.). Instruments will show you in a graphical environment how memory usage evolves, or how long it takes for specific functions to perform, etc.