DiegoCatalano / Catalano-Framework

Framework
GNU Lesser General Public License v3.0
295 stars 99 forks source link

OutOfMemory Issue #39

Closed GowthamanRajasekaran closed 6 years ago

GowthamanRajasekaran commented 7 years ago

Hi @DiegoCatalano,

       While i captured image using android Indent and after converting to mutable bitmap image with **_Bitmap.Config.ARGB_8888_** and passing to Fastbitmap  the following error arises,

E/AndroidRuntime: FATAL EXCEPTION: main Process: catalano.imaging, PID: 3401 java.lang.OutOfMemoryError: Failed to allocate a 31961100 byte allocation with 12540956 free bytes and 11MB until OOM at catalano.imaging.FastBitmap.refresh(FastBitmap.java:179) at catalano.imaging.FastBitmap.(FastBitmap.java:82)

Please any one give solution to solve this,

Thanking You !!

DiegoCatalano commented 7 years ago

@GowthamanRajasekaran, Android doesn't allow to allocate much data. I'll give you some tips.

1) Large heap

In your tag \<application> in AndroidManifest.xml, add:

android:largeHeap="true"

2) Save your image in the storage, recycle the bitmap if its in the memory, so you can load the image directly in the FastBitmap, this can avoid duplicate bitmap.

3) NDK filters, In this case I need to implements all the filters in C++. I'll to do this in the future.

I hope I have helped you.