Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

Commit 20c8c8e6 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Lua: also print free memory after unloading a script or after starting to run it in background

--HG--
branch : lua_fix
parent c2de82c33657
......@@ -117,6 +117,17 @@ int lua_msg_queue_receive(lua_State * L, uint32_t * msg, int timeout)
return msg_queue_receive(script->key_mq, msg, timeout);
}
static void lua_print_free_mem(void)
{
extern int core_reallocs; /* ml-lua-shim.c */
extern int core_reallocs_size;
printf("[Lua] free umm_heap : %s\n", format_memory_size(umm_free_heap_size()));
if (core_reallocs)
{
printf("[Lua] core reallocs : %d (%s)\n", core_reallocs, format_memory_size(core_reallocs_size));
}
}
/*
Determines if a string ends in some string
*/
......@@ -853,6 +864,9 @@ static void load_script(struct lua_script * script)
printf("[%s] script finished.\n\n", script->filename);
}
/* print available memory */
lua_print_free_mem();
/* script finished or loaded in background; allow auto power off */
powersave_permit();
}
......@@ -1336,13 +1350,7 @@ static void lua_load_task(int unused)
lua_do_autoload();
extern int core_reallocs; /* ml-lua-shim.c */
extern int core_reallocs_size;
printf("[Lua] free umm_heap : %s\n", format_memory_size(umm_free_heap_size()));
if (core_reallocs)
{
printf("[Lua] core reallocs : %d (%s)\n", core_reallocs, format_memory_size(core_reallocs_size));
}
lua_print_free_mem();
printf("[Lua] all scripts loaded.\n");
if (console_visible && !console_was_visible)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment