Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for limiting overall memory when running decompilations and tools #270

Closed
s3rvac opened this issue Apr 4, 2018 · 1 comment

Comments

@s3rvac
Copy link
Member

s3rvac commented Apr 4, 2018

We should add support for limiting the overall memory when running decompilations and tools to prevent issues like #36 and #81 (black screen when decompiling on Windows). On Linux, it is pretty easy to limit virtual memory via ulimit -v, but on Windows, this is not that straightforward.

Our scripts and tools should have a parameter by which one could control the maximal virtual memory (e.g. --max-memory). By default, this should be set to half of the available memory on the system. When a tool has allocated more than this limit, further allocations should fail with std::bad_alloc instead of starting swapping.

Note: We should of course try to reduce the memory requirements of our tools (see e.g. #13). This new parameter represents just a precaution to reduce swapping, and should be taken as such.

@s3rvac
Copy link
Member Author

s3rvac commented Apr 11, 2018

Implemented in #272.

Details:

  • Added a new module memory into retdec::utils, which provides ways of limiting the available memory of the current process (b63d814). Supported platforms are Windows, Linux, and macOS.
  • Added new parameters --max-memory and --max-memory-half-ram into retdec-fileinfo (bf0a1c6). By default, there is no memory limit when you run the tool.
  • Added new parameters -max-memory and -max-memory-half-ram into retdec-bin2llvmir and retdec-llvmir2hll (a7516cb and 349c595). By default, there is no memory limit when you run the tools.
  • Added new parameters --max-memory and --no-memory-limit into retdec-decompiler.sh (23434fa). By default, the script limits the memory of the above tools into half of system RAM to prevent potential black screens (especially on Windows). Use --no-memory-limit to remove this limit.
  • Regression tests were added in the issue-270-limiting-overall-memory branch (merge: avast/retdec-regression-tests@0b9c04f).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant