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

using NSMutableArray sortUsingFunction instead of NSArray sortedArray… #152

Merged
merged 1 commit into from
Dec 20, 2016

Conversation

linyehui
Copy link
Contributor

@linyehui linyehui commented Dec 6, 2016

NSArray的排序方法是:sortedArrayUsingFunction
NSMutableArray的排序方法是:sortUsingFunction

self.sortList是一个NSMutableArray,直接使用NSMutableArray的排序方法sortUsingFunction不需要进行内存复制,可以提高性能;

另外在多线程中使用LFStreamSocket进行推流时(sample工程不是这么用的,没问题),不必要的内存复制会导致内存泄漏,出现的内存泄漏问题类似于:
http://stackoverflow.com/questions/5200857/memory-leaks-from-multidimensional-array-nsmutablearray-nsarray-addobject-and

…UsingFunction

性能优化,同时也会修正多线程下使用LFStreamSocket推流的内存泄漏问题
@chenliming777 chenliming777 merged commit 2989ffd into LaiFengiOS:master Dec 20, 2016
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

Successfully merging this pull request may close these issues.

2 participants