Skip to content

Commit

Permalink
AP_Scripting: added ability to expand heap at runtime if armed
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Mar 15, 2024
1 parent c183c10 commit ac7d234
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions libraries/AP_Scripting/AP_Scripting.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ class AP_Scripting
LOG_RUNTIME = 1U << 3,
DISABLE_PRE_ARM = 1U << 4,
SAVE_CHECKSUM = 1U << 5,
DISABLE_HEAP_EXPANSION = 1U << 6,
};

private:
Expand Down
3 changes: 2 additions & 1 deletion libraries/AP_Scripting/lua_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ lua_scripts::lua_scripts(const AP_Int32 &vm_steps, const AP_Int32 &heap_size, AP
_debug_options(debug_options),
terminal(_terminal)
{
_heap.create(heap_size, 4);
const bool allow_heap_expansion = !option_is_set(AP_Scripting::DebugOption::DISABLE_HEAP_EXPANSION);
_heap.create(heap_size, 10, allow_heap_expansion, 20*1024);
}

lua_scripts::~lua_scripts() {
Expand Down

0 comments on commit ac7d234

Please sign in to comment.