joshuto icon indicating copy to clipboard operation
joshuto copied to clipboard

OOM when displaying hyperlink

Open dnalor opened this issue 2 years ago • 3 comments

(Linux, Rust 1.65, joshuto master, built from source) When using mdcat as a previewer, displaying some documents resulted in joshuto immediately claiming all available memory, resulting in system swapping / OOM Some experimentation narrowed this down to documents containing a hyperlink, which mdcat formats to be displayed in terminals Can be reproduced by e.g. using ls --hyperlink=always in preview_file.sh

dnalor avatar Jan 06 '23 11:01 dnalor

Can you try building joshuto without syntax_highlight feature?

Cargo.toml

...
[features]
...
default = []

kamiyaa avatar Jan 09 '23 23:01 kamiyaa

Can you try building joshuto without syntax_highlight feature?

default = [] results in error[E0433]: failed to resolve: use of undeclared crate or module trash default = [""devicons", "recycle_bin"" ] builds.

The resulting binary doesn't cause OOM anymore. Preview displays raw ANSI for all files:

[0m[38;5;148mfeatures[0m[38;5;231m [0m[38;5;231m=[0m[38;5;231m [0m[38;5;231m[[0m[38;5;231m
  [0m[38;5;186m"v4"[0m[38;5;231m,[0m[38;5;231m

dnalor avatar Jan 10 '23 21:01 dnalor

Got it, thanks! It looks like this issue is most likely linked to ansi-to-tui, the parsing lib for providing syntax highlighting.

The solution for now is to disable this feature and create an issue on their repo

kamiyaa avatar Jan 27 '23 12:01 kamiyaa