Coder Social home page Coder Social logo

konachan-ios's Introduction

小笠原 やきん Top Langs

konachan-ios's People

Contributors

917 avatar yaqinking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hstdt

konachan-ios's Issues

Offline mode 快速滑動會引起 crash

設置:

  • Preview Image Type: Predownload pictures
  • Download Image Type: Sample
  • Preload next page image: On
  • Offline mode: On

上下來回滑動速度很快的時候 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 值內之後,解決。上面設置爲設備最大內存的一半

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.