facebookexperimental / MIRAI

Rust mid-level IR Abstract Interpreter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lower memory requirements

nitnelave opened this issue · comments

Issue

Analyzing a create is taking huge amounts of memory. If there is no way around that, it should at least be called out in the docs.

Steps to Reproduce

Clone LLDAP (https://github.com/lldap/lldap).
Run cargo mirai.

Expected Behavior

Diagnostics returned in a reasonable amount of time

Actual Results

10GB of resident memory (12+GB of virtual memory) on a system with 16, and I think issues with swapping.

Environment

rustc 1.67.1 (d5a82bbd2 2023-02-07)
Mirai installed with info: latest update on 2023-03-22, rust version 1.70.0-nightly (1db9c061d 2023-03-21)

Static analysis of the kind that MIRAI does is inherently exponential. There are numerous hacks and heuristics for trying to make sure it never happens in practice., but they only go so far. Given a particular instance of exponential behavior it is often possible to resolve it by adding a heuristic. Unfortunately this is extremely complex and time-consuming, so it going to take a while.

One way to work around this in the meanwhile is to figure out which function is causing the analysis to diverge. One you know the culprit, please 1) update this issue with your findings and 2) either just modify the code to make the function into a dummy (when you analyze with MIRAI: cfg!(mirai)) and add a foreign_contracts module with an explicit summary of the function.

No updates.