Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

内存泄漏有几种类型?有哪些排查方式 #25

Open
tbfungeek opened this issue Jan 5, 2020 · 0 comments
Open

内存泄漏有几种类型?有哪些排查方式 #25

tbfungeek opened this issue Jan 5, 2020 · 0 comments

Comments

@tbfungeek
Copy link
Owner

tbfungeek commented Jan 5, 2020

内存泄漏类型

  • 对象型变量作为C语言结构体,或者联合体(struct、union)的成员
    __unsafe_unretained修饰符的变量不属于编译器的内存管理对象。如果管理时不注意赋值对象的所有者,便可能遭遇内存泄露或者程序崩溃。
  • 循环引用
  • 对象被单例等长生命周期的对象持有
  • CF类型内存没有释放
    注意以creat,copy作为关键字的函数都是需要释放内存的.

内存泄漏的排查方法

  • 静态分析方法(Analyze)
  • 动态分析方法(Instrument工具库里的Leaks,Allocations)
  • 在可疑对象的dealloc方法中添加log进行查看
  • 使用三方开源库:MLeaksFinder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant