Giter VIP home page Giter VIP logo

Comments (6)

spidfire avatar spidfire commented on May 31, 2024

Same here and if I continueud my app crashed with:

FATAL EXCEPTION: Thread-28383
java.lang.OutOfMemoryError: Failed to allocate a 2789388 byte allocation with 1797128 free bytes and 1755KB until OOM
   at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
   at android.graphics.Bitmap.nativeCreate(Native Method)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:831)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
   at android.graphics.Bitmap.createBitmap(Bitmap.java:775)
   at com.facebook.imagepipeline.memory.BitmapPool.alloc(BitmapPool.java:55)
   at com.facebook.imagepipeline.memory.BitmapPool.alloc(BitmapPool.java:30)
   at com.facebook.imagepipeline.memory.BasePool.get(BasePool.java:259)
   at com.facebook.imagepipeline.platform.ArtDecoder.decodeStaticImageFromStream(ArtDecoder.java:137)
   at com.facebook.imagepipeline.platform.ArtDecoder.decodeJPEGFromEncodedImage(ArtDecoder.java:120)
   at com.facebook.imagepipeline.decoder.ImageDecoder.decodeJpeg(ImageDecoder.java:154)
   at com.facebook.imagepipeline.decoder.ImageDecoder.decodeImage(ImageDecoder.java:85)
   at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:194)
   at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:97)
   at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:129)
   at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:207)
   at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:27)
   at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:78)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
   at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
   at java.lang.Thread.run(Thread.java:818)

I guess there is a memory leak

from frescoimageviewer.

troy379 avatar troy379 commented on May 31, 2024

Hi guys!
According to Fresco support, they aren't supports large images without resizing, but it will be bad for image quality when it zoomed in. If you use really big images, try to use android:largeHeap="true" and(or) setDownsampleEnabled(true) as the workaround. I've tested it with 4k images on emulator with 512 of RAM and OOM wasn't occurred, but nevertheless lags are still present.

Anyway, I agree that library, that gives you zooming opportunity must support such case well. And only one idea that I have is to use library Subsampling Scale Image View, but it works only with local images. I've tried to find modified version for DraweeViews, but only thing that I've found is this issue.
I'll add this to my to-do list, but i don't know, when I'll have enough time for this. However, any ideas are welcome.

from frescoimageviewer.

spidfire avatar spidfire commented on May 31, 2024

kotlin:

 val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
        val imagePipelineConfig = ImagePipelineConfig.newBuilder(context.getApplicationContext())
                .setBitmapMemoryCacheParamsSupplier(LollipopBitmapMemoryCacheParamsSupplier(activityManager))
                .setDownsampleEnabled(true)
                .build()

        Fresco.initialize(context.getApplicationContext(), imagePipelineConfig)

I did the down-sample workaround but still the error occurs if I swipe too many times (i've got a gallery with 300+ images).
image
I guess there is no truncating of old images

But it does solve te 4000x4000 image problem.

from frescoimageviewer.

troy379 avatar troy379 commented on May 31, 2024

Yep, finally i caught it, thanx! :)
I've tried with 1000 different images and after fast swiping of ~300 images it crashed. I'll see what I can do with this.

from frescoimageviewer.

troy379 avatar troy379 commented on May 31, 2024

I've fixed this leak and now all is working fine.
@spidfire Please, update library version to 0.4.0 and thanks for feedback!

from frescoimageviewer.

spidfire avatar spidfire commented on May 31, 2024

👍
image

from frescoimageviewer.

Related Issues (20)

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.