Skip to content

Running ble.sh takes too much memory - eval_unsafe_arith #2263

Open
@andychu

Description

@andychu

From

#1069 (comment)

~/.mwg/git/oilshell/oil/_bin/cxx-asan/osh --rcfile oshrc.source

Oh actually don't test with cxx-asan !

Ah, yeah. I actually wasn't sure about how I should generate the non-ASAN binary. That's the reason I also tested the behavior with the tarball of 0.27.0 from the release page. As I've already written in #1069 (comment), the same behavior is observed with the release tarball of 0.27.0. It still uses 1.1 GB memory with shopt -s eval_unsafe_arith.

You should do ninja _bin/cxx-opt/osh, and then run that binary.

Without eval_unsafe_arith

$ ~/.mwg/git/oilshell/oil/_bin/cxx-opt/osh --rcfile oshrc.source
  shopt -s checkwinsize
  ^~~~~
out/ble.osh:2815: 'shopt' got invalid option 'checkwinsize'
osh warning: The 'RETURN' hook isn't implemented
[??? no location ???] warning: Invalid start of UTF-8 sequence
[??? no location ???] warning: Invalid start of UTF-8 sequence
RSS: 38244
[ble: elapsed 930ms, CPU 98.9% (self)usr4ms/sys0+(child)usr530ms/sys388ms]

With eval_unsafe_arith

$ ~/.mwg/git/oilshell/oil/_bin/cxx-opt/osh --rcfile oshrc.source
  shopt -s checkwinsize
  ^~~~~
out/ble.osh:2815: 'shopt' got invalid option 'checkwinsize'
osh warning: The 'RETURN' hook isn't implemented
[??? no location ???] warning: Invalid start of UTF-8 sequence
[??? no location ???] warning: Invalid start of UTF-8 sequence
RSS: 1087120
[ble: elapsed 964ms, CPU 98.9% (self)usr3ms/sys2ms+(child)usr538ms/sys413ms]

So, the updated table would be this:

Python version osh (cxx-asan) osh (cxx-opt) Bash 5.3-beta (for ref)
Without eval_unsafe_arith 69.23 MB (41.64s) 157.9 MB (6.364s) 38.24 MB (0.930s) 14.77 MB (0.178s)
With eval_unsafe_arith 69.17 MB (41.45s) 1.207 GB (6.421s) 1.087 GB (0.964s) N/A

OK, the memory footprint without eval_unsafe_arith is smaller than the Python version and only 2x as large as Bash 5.3. Also, the execution time was much improved to be 5x slower compared to Bash. However, with eval_unsafe_arith, it still uses 1.1 GB.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions