From 52ca90fd2d9a0a268c3adce17621680c3ecf38a7 Mon Sep 17 00:00:00 2001 From: Michael van der Werve Date: Thu, 21 Mar 2019 15:28:37 +0100 Subject: [PATCH] function_signature should be freed, otherwise 64 bytes of memory is leaked each time the bytecode is constructed --- src/bytecode.cpp | 9 +++++++++ src/bytecode.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bytecode.cpp b/src/bytecode.cpp index 3c18ac1..2e2ae7a 100644 --- a/src/bytecode.cpp +++ b/src/bytecode.cpp @@ -88,6 +88,15 @@ Bytecode::Bytecode(const Source& source) : jit_exception_set_handler(original_handler); } +/** + * Destructor + */ +Bytecode::~Bytecode() +{ + // if there is a signature, we need to free it + if (_function_signature) jit_type_free(_function_signature); +} + /** * Method to initialize an error label * @param label diff --git a/src/bytecode.h b/src/bytecode.h index fd00447..487f85a 100644 --- a/src/bytecode.h +++ b/src/bytecode.h @@ -284,7 +284,7 @@ class Bytecode : private Generator, public Executor /** * Destructor */ - virtual ~Bytecode() {}; + virtual ~Bytecode(); /** * Execute the template given a certain handler