Why would I ever NOT use BitmapFactory's inPurgeable option?

前端 未结 4 1733
臣服心动
臣服心动 2020-12-02 18:48

Android\'s BitmapFactory.Options.inPurgeable has been recommended in various places as a way to avoid OutOfMemory exceptions in Android 2.x and earlier (Android

4条回答
  •  Happy的楠姐
    2020-12-02 19:40

    If your are reading your bitmaps from the filesystem, using this flag wil force Android to keep the file open (at least in 4.0.4) to be able to re-read it. After reading more than 1024 files, you will reach the limit of opened files and get a "Too many open files" error.

    You can observe the beahavior by using the lsof command from a rooted terminal and review all opened files.

提交回复
热议问题