Skip to content

Commit

Permalink
Fixes Memory Leak in JIT (#139)
Browse files Browse the repository at this point in the history
* Fixes memory leak in JIT by introducing a memory management container struct.
  • Loading branch information
Lichtso committed Feb 10, 2021
1 parent fcde4bd commit 575506c
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 108 deletions.
4 changes: 2 additions & 2 deletions src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extern crate scroll;
use crate::{
ebpf,
error::{EbpfError, UserDefinedError},
jit::{compile, JitProgram},
jit::JitProgram,
vm::{Config, Executable, InstructionMeter, SyscallRegistry},
};
use byteorder::{ByteOrder, LittleEndian};
Expand Down Expand Up @@ -253,7 +253,7 @@ impl<E: UserDefinedError, I: InstructionMeter> Executable<E, I> for EBpfElf<E, I

/// JIT compile the executable
fn jit_compile(&mut self) -> Result<(), EbpfError<E>> {
self.compiled_program = Some(compile::<E, I>(self)?);
self.compiled_program = Some(JitProgram::<E, I>::new(self)?);
Ok(())
}

Expand Down

0 comments on commit 575506c

Please sign in to comment.