markor icon indicating copy to clipboard operation
markor copied to clipboard

Handle cases where the file is larger than max allowed memory

Open opusforlife2 opened this issue 1 year ago • 5 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a enhancement/feature request. Not a bug or question.
  • [X] The topic is not already reported at Issues. (I've searched it).
  • [X] Markor is up to date. See Releases for the latest version. Updates are available from F-Droid and GitHub.
  • [X] Is the wanted feature/enhancement present in the latest code version (git master)? Please download and try the test version of Markor, named Mordor. No worries Markor and Mordor appear as completely separate applications, you can install both side-by-side and Markor settings are not touched. If so, the change will be part of the next Markor update.

Description

The app should gracefully handle cases where the file being opened is larger than Markor's memory limit, instead of crashing. I tried opening a 10 MB hosts file with Markor and got an OOM crash after a non-responsive screen showed for a few seconds.

If there is a known hard limit to the file size, then a dialog could be shown simply rejecting opening the file and informing the user of the cause.

If the only way to know for sure is to keep allocating more and more RAM until the file can be opened or an OOM error occurs, then a loading circle should be shown at least. Maybe a progress bar as well?

Information

Android version: 12 App Version: 2.10.4

Source

F-Droid

Format / File type

Not specific

Additional info / Log

No response

opusforlife2 avatar Sep 18 '22 14:09 opusforlife2

Most of time already goes into making file management and syntax highlighting well working and performant.

If you want improvements, Markor really needs help in terms of contributors. Thanks.

gsantner avatar Sep 18 '22 14:09 gsantner

The best can be done probably is to show a crash handler, so #1895 if a file was too much. After all we only know afterwards that it was too much, not in advance. Otherwise, by best it's a guessing game with defining some arbitrary numbers. File size of 10MB doesn't mean it only requires 10MB of RAM.

Progress bar won't help you there either, if the file is too big it might crash then at 80% loading. What would that help you? Nothing, as either way you try, it won't load.

gsantner avatar Nov 05 '22 12:11 gsantner

after a non-responsive screen showed for a few seconds

This is what the progress bar is intended to solve. Indicating to the user that the OS/app isn't hanging and is actually trying to open the file.

opusforlife2 avatar Nov 05 '22 12:11 opusforlife2

This is however something completly else. The topic is about handling errors due too big files.
What you however now suggest is a file loading progress UI indicator.

They are two very different topics. One won't really fix/help the other.

gsantner avatar Nov 05 '22 13:11 gsantner

If there is a known hard limit to the file size, then a dialog could be shown simply rejecting opening the file and informing the user of the cause.

This was the original request. You've stated it isn't possible.

If the only way to know for sure is to keep allocating more and more RAM until the file can be opened or an OOM error occurs, then a loading circle should be shown at least. Maybe a progress bar as well?

This was the alternative suggested. Now I'm focusing on this. It's just a matter of changing the title and description.

opusforlife2 avatar Nov 05 '22 13:11 opusforlife2