a16z / halmos

A symbolic testing tool for EVM smart contracts
GNU Affero General Public License v3.0
786 stars 62 forks source link

Set z3 memory limit #204

Open daejunpark opened 11 months ago

daejunpark commented 11 months ago

For some nonlinear queries, the peak memory usage of z3 may be quite high. If the system memory is not enough (e.g., the Github-hosted ubuntu and windows runners), such z3 process may be killed due to OOM, crashing halmos.

To prevent this, introduce an additional option, say --solver-max-memory, that sets the max memory of z3:

solver.set(max_memory=<size-in-megabytes>)

Also, set the default max memory of z3, based on the system memory size, e.g., using psutil.

daejunpark commented 11 months ago

Related to #125

aviggiano commented 11 months ago

I think max_memory could be automatically set by default to e.g. 80%-90% of the system capacity. Then advanced users can override this value with --solver-max-memory