First code cleanup for better memory management

This commit is contained in:
Matteo Biscosi 2024-02-14 16:12:28 +00:00
parent b5a4c2621b
commit 2f76c9bf4b
21 changed files with 968 additions and 852 deletions

View file

@ -0,0 +1,23 @@
--
-- (C) 2016-24 - ntop.org
--
local dirs = ntop.getDirs()
package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path
-- #################################
local profiling = {}
-- #################################
function profiling.get_current_memory(file)
require "lua_trace"
local lua_memory_usage = collectgarbage("count")
traceError(TRACE_NORMAL, TRACE_CONSOLE, "Currently executing file: " .. file .. "; Current LUA memory usage: " .. lua_memory_usage .. " KB")
end
-- #################################
return profiling