TeamAmaze / AmazeFileManager

Material design file manager for Android
https://teamamaze.xyz
GNU General Public License v3.0
5.35k stars 1.58k forks source link

Large file causes Text reader to crash #1275

Open kofuk opened 6 years ago

kofuk commented 6 years ago

The app crashed on my Nexus 7(2013), Android 7.12(LineageOS)

How to reproduce

  1. Open large file with Text reader(On my Nexus7(2013), 4042 KB)
  2. Move to home(launcher) or overview screen.
  3. The app crashes! Android said, "data parcel size 2472732 bytes"

Probably, this is related to: https://developer.android.com/about/versions/nougat/android-7.0-changes#other

EmmanuelMess commented 6 years ago

In what version of Amaze are you? Can't replicate with an 9 MB file, in master, Pixel 2, Android 8.1.

kofuk commented 6 years ago

I used v.3.2.1, latest release. I have the same problem on Nexus 5X, Android 8.0.1. Nexus 7 and 5X has as less as 2GB of memory. This may be the cause of the problem.

EmmanuelMess commented 6 years ago

Nexus 7 and 5X has as less as 2GB of memory. This may be the cause of the problem.

I'll reopen for test in a real device.

TranceLove commented 6 years ago

Sounds like something I faced back in the Gingerbread days...

If you need, try play with the updated TextEditorActivityEspressoTest in TranceLove:AmazeFileManager/verify/issue1275. So far just played with Galaxy Nexus emulator (1GB RAM) running 5.1.1 opening a 4096KB text file, loaded slow but didn't crash. But TextEditorActivity is just running standalone, so YMMV.

VishalNehra commented 6 years ago

I'm getting OutOfMemoryException when loading a 50Mb text file in Nexus 5x running API19. Please note, many famous file managers don't load text files over a certain size (solid explorer has a 2mb limit). I suggest doing the same. In older versions of Amaze we had something like, loading only a limited lines in text editor first, loading more of them as user scrolled. It had it's own obvious downsides so we had to remove that implementation.

EmmanuelMess commented 6 years ago

In older versions of Amaze we had something like, loading only a limited lines in text editor first, loading more of them as user scrolled. It had it's own obvious downsides so we had to remove that implementation.

AFAIK Linux has ways of doing this automatically. My Linux memory managment knowledge tells me that if we read the file from the buffer lazily the memory will not be consumed until the user scroll enough down.

VishalNehra commented 6 years ago

It's possible, but conventional android EditText doesn't support something like this.

On Thu 28 Jun, 2018, 6:14 PM Emmanuel, notifications@github.com wrote:

In older versions of Amaze we had something like, loading only a limited lines in text editor first, loading more of them as user scrolled. It had it's own obvious downsides so we had to remove that implementation.

AFAIK Linux has ways of doing this automatically. My Linux memory managment knowledge tells me that if we read the file from the buffer lazily the memory will not be consumed until the user scroll enough down.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/TeamAmaze/AmazeFileManager/issues/1275#issuecomment-401021291, or mute the thread https://github.com/notifications/unsubscribe-auth/AE-FsDye_h7j9R5eafRV6MWqrE-SDhUbks5uBM_GgaJpZM4UhhxS .

EmmanuelMess commented 6 years ago

StackOverflow proposes loading into a ListView and dividing the text into pages to be shown in each item.

TranceLove commented 3 years ago

Is it possible that we use a "sliding window" method to handle big files?

What I have in mind is

What do you think?

VishalNehra commented 3 years ago

@TranceLove We had this implementation in previous versions of Amaze. I'll find the apk . We can try to continue from there.