We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
設置:
上下來回滑動速度很快的時候 100% 引起 crash。
大概原因能猜到是因爲內存佔用過高。
解決方法是:
給 SDWebImage 設定最大內存緩存佔用數值
// 在 viewDidLoad: 里 [[SDImageCache sharedImageCache] setMaxMemoryCost:[self deviceMaxMemoryCost]]; - (NSInteger)deviceMaxMemoryCost { unsigned long long physicalMemory = [NSProcessInfo processInfo].physicalMemory; NSInteger allowedMaxMemory = physicalMemory*0.5/4; return allowedMaxMemory; }
由於 SDWebImage 使用 NSCache 作爲緩存,而 NSCache 佔用的內存並不會在 Xcode Debug Seesion Tab 的 Memory Usage 里顯示出來,需要使用在 Instruments 里才能看到是 CG raster data 在佔用大量的內存,設定好上面的值讓它在 iOS 系統單個 app 的最大 limit 值內之後,解決。上面設置爲設備最大內存的一半
The text was updated successfully, but these errors were encountered:
47fc727
No branches or pull requests
設置:
上下來回滑動速度很快的時候 100% 引起 crash。
大概原因能猜到是因爲內存佔用過高。
解決方法是:
給 SDWebImage 設定最大內存緩存佔用數值
由於 SDWebImage 使用 NSCache 作爲緩存,而 NSCache 佔用的內存並不會在 Xcode Debug Seesion Tab 的 Memory Usage 里顯示出來,需要使用在 Instruments 里才能看到是 CG raster data 在佔用大量的內存,設定好上面的值讓它在 iOS 系統單個 app 的最大 limit 值內之後,解決。
上面設置爲設備最大內存的一半The text was updated successfully, but these errors were encountered: