Skip to content

chore(apollo_compile_to_casm): limit casm compilation memory usage #6365

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

Open
wants to merge 1 commit into
base: noam.s/fix_apollo_compile_to_casm_extract_the_casm_json_from_the_compilers_output
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crates/apollo_compile_to_casm/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use tracing::info;
use crate::config::SierraCompilationConfig;
use crate::constants::CAIRO_LANG_BINARY_NAME;

// TODO(Noa): Reconsider the default value.
const DEFAULT_MAX_MEMORY_USAGE: u64 = 5 * 1024 * 1024 * 1024;

#[derive(Clone)]
pub struct SierraToCasmCompiler {
pub config: SierraCompilationConfig,
Expand All @@ -37,7 +40,7 @@ impl SierraToCasmCompiler {
"--allowed-libfuncs-list-name",
"all",
];
let resource_limits = ResourceLimits::new(None, None, None);
let resource_limits = ResourceLimits::new(None, None, Some(DEFAULT_MAX_MEMORY_USAGE));

let stdout = compile_with_args(
compiler_binary_path,
Expand Down