fix(interpreter): allocate stack on heap

This commit is contained in:
2025-07-08 17:40:57 +09:00
parent 20e45679fc
commit aea3143b4b
4 changed files with 36 additions and 35 deletions

View File

@@ -5,15 +5,16 @@ use super::interpreter::InterpreterError;
/// 2*20 = 1MiB
const MEMORY_SIZE: usize = 1048576;
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone)]
pub struct Memory {
pub raw: [Byte; MEMORY_SIZE as usize],
pub raw: Vec<Byte>,
}
impl Memory {
pub fn new() -> Self {
Self {
raw: [0; MEMORY_SIZE as usize],
// allocating is better for such bigger objects
raw: vec![0u8; MEMORY_SIZE],
}
}