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

OutOfMemoryError: Failed to allocate a 251648770 byte allocation [Local large images allocation issue] #2732

Open
zetbrush opened this issue Jun 22, 2023 · 2 comments

Comments

@zetbrush
Copy link

Description

For local files (images) which are pretty large on size (e.g. 180 - 300 MB PNGs), fresco tries to allocate exact the same ByteBuffer at LocalFetchProducer, before creating EncodedImage instance, thus leading to instantly OOM

Reproduction

stacktrace

FATAL EXCEPTION: FrescoIoBoundExecutor-2 Process: com.p.s, PID: 24581 java.lang.OutOfMemoryError: Failed to allocate a 251648770 byte allocation with 100663296 free bytes and 469MB until OOM, target footprint 145550240, growth limit 536870912 at dalvik.system.VMRuntime.newNonMovableArray(Native Method) at java.nio.DirectByteBuffer$MemoryRef.<init>(DirectByteBuffer.java:70) at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:260) at com.facebook.imagepipeline.memory.BufferMemoryChunk.<init>(BufferMemoryChunk.java:38) at com.facebook.imagepipeline.memory.BufferMemoryChunkPool.alloc(BufferMemoryChunkPool.java:31) at com.facebook.imagepipeline.memory.BufferMemoryChunkPool.alloc(BufferMemoryChunkPool.java:16) at com.facebook.imagepipeline.memory.BasePool.get(BasePool.java:256) at com.facebook.imagepipeline.memory.MemoryPooledByteBufferOutputStream.<init>(MemoryPooledByteBufferOutputStream.java:55) at com.facebook.imagepipeline.memory.MemoryPooledByteBufferFactory.newByteBuffer(MemoryPooledByteBufferFactory.java:75) at com.facebook.imagepipeline.memory.MemoryPooledByteBufferFactory.newByteBuffer(MemoryPooledByteBufferFactory.java:25) at com.facebook.imagepipeline.producers.LocalFetchProducer.getByteBufferBackedEncodedImage(LocalFetchProducer.java:83) at com.facebook.imagepipeline.producers.LocalFetchProducer.getEncodedImage(LocalFetchProducer.java:93) at com.facebook.imagepipeline.producers.LocalFileFetchProducer.getEncodedImage(LocalFileFetchProducer.java:33) at com.facebook.imagepipeline.producers.LocalFetchProducer$1.getResult(LocalFetchProducer.java:47) at com.facebook.imagepipeline.producers.LocalFetchProducer$1.getResult(LocalFetchProducer.java:43) at com.facebook.common.executors.StatefulRunnable.run(StatefulRunnable.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:52) at java.lang.Thread.run(Thread.java:1012)

Additional Information

  • Fresco version: [2.6.0]
  • Platform version: on latest OS/ Hi end device (non platform specific)
@zetbrush
Copy link
Author

cc @oprisnik

@zetbrush
Copy link
Author

zetbrush commented Nov 1, 2023

Hey, any news on this? cc @cortinico @defHLT

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

No branches or pull requests

1 participant