diff --git a/src/main.rs b/src/main.rs
index 8f3eb2c4c4598d321234a1b354a167db2ac80393..512ab42e57b5a604adc5cbbf0941df1cbdfa0ee3 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -19,16 +19,22 @@ use std::{
 	collections::BTreeSet,
 	fmt::Display,
 	fs,
-	io::{self, BufRead as _, Write}
+	io::{self, BufRead as _, Write},
+	sync::RwLock
 };
 
+static MEM_LIMIT: RwLock<String> = RwLock::new(String::new());
+
 #[derive(Debug, Parser)]
 struct Args {
 	#[clap(short = 'C', long, default_value = ".")]
 	directory: PathBuf,
 
 	#[clap(short = 'c', long, default_value = "23ws-malo")]
-	course: String
+	course: String,
+
+	#[clap(short, long, default_value = "2G")]
+	mem_limit: String
 }
 
 #[allow(non_camel_case_types, clippy::upper_case_acronyms)]
@@ -146,6 +152,7 @@ fn ask_time(question: impl Display) -> Time {
 
 fn main() {
 	let args = Args::parse();
+	*(MEM_LIMIT.write().unwrap()) = args.mem_limit;
 
 	// process arguments
 	let directory = args.directory.canonicalize_utf8().unwrap();
diff --git a/src/render/mod.rs b/src/render/mod.rs
index 46e0c5ba4b2a8a6ca3906e88f91b3f77fb8a31a2..6310971e1e43d2c00b78e3cd751bed097ec09870 100644
--- a/src/render/mod.rs
+++ b/src/render/mod.rs
@@ -8,7 +8,7 @@ use crate::{
 	iotro::{intro, outro},
 	render::ffmpeg::{Ffmpeg, FfmpegInput},
 	time::{format_date, Time},
-	Project, ProjectSourceMetadata, Resolution
+	Project, ProjectSourceMetadata, Resolution, MEM_LIMIT
 };
 use anyhow::{bail, Context};
 use camino::{Utf8Path as Path, Utf8PathBuf as PathBuf};
@@ -21,8 +21,6 @@ use std::{
 	process::{Command, Stdio}
 };
 
-const MEMORY_LIMIT: &str = "2G";
-
 const INTRO_LEN: Time = Time {
 	seconds: 3,
 	micros: 0
@@ -48,7 +46,7 @@ fn cmd() -> Command {
 		.arg("-q")
 		.arg("--expand-environment=no")
 		.arg("-p")
-		.arg(format!("MemoryMax={MEMORY_LIMIT}"))
+		.arg(format!("MemoryMax={}", MEM_LIMIT.read().unwrap()))
 		.arg("--user");
 	// we use busybox ash for having a shell that outputs commands with -x
 	cmd.arg("busybox")