Both of these behaviors are highly unusual. I've been using KM for years and have never observed anything like that, nor have I seen other users complain about it. I also have several colleagues that are KM power users, and AFAIK they have see this type of behavior.
It is very strange that the KM Engine is using 4.5-6 GB of RAM. That makes me think you must have some KM Variables that are storing very large amounts of data, maybe even binary data. I suggest you review your KM Variables, and Named Clipboards, in the KM Editor Preferences, and delete everything that you don't need. If you need to store large amounts of data then do so in files, NOT KM Variables or Named Clipboards.
As a standard practice, I now use only KM Local or Instance Variables unless I absolutely need the Variable for other Macros or subsequent executions of the same macro.
Here is a JXA Script that will export KM Engine Log entires that are abnormal, meaning it excludes the entries for normal Macro execution.
If you want to see all of the last 200 entries, just comment out this line:
oDoc.text = logErrorsList.join("\n");
JXA Script to Export to BBEdit Last 200 KM Engine Logs
'use strict';
(function run() {
var ptyScriptName = "Copy Last KM Engine Log Entries to BBEdit"
var ptyScriptVer = "2.0"
var ptyScriptDate = "2018-03-20"
var ptyScriptAuthor = "@JMichaelTX"
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RETURNS: One of these, as text:
• Actual Log Entry (String) for LAST Error Log
• "[ERROR]" at start of results if a script error occurred.
KM VARIABALES REQUIRED:
• NONE
KM VARIABLES SET:
• NONE
REF:
• Chris Stone (@ccstone), email, 2016-10-18, Shell Script to Read KM Log
TAGS: @errors @KM @Macro @Log @JXA @ShellScript @ccstone
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
var returnResults = "TBD" // Set your results to this var
try {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var app = Application.currentApplication()
app.includeStandardAdditions = true
//--- GET THE LAST 200 LOG ENTRIES ---
var cmdStr = "tail -n 200 ~/\"Library/Logs/Keyboard Maestro/Engine.log\""; // thanks to Chris Stone
var logList = app.doShellScript(cmdStr);
logList = logList.split(/[\r\n]/); // split using EITHER RETURN or NEWLINE
//--- FILTER LIST TO ONLY THOSE WITH ACTUAL ERRORS ---
var logErrorsList = logList.filter(function (pArrayElem) {
//--- EXCLUDE Logs with below text (normal Macro Execution) ---
return ! (/Execute macro|Running application/i.test(pArrayElem));
//return (/while executing|execution error/i.test(pArrayElem));
});
//--- GET THE LAST ERROR LOG ENTERED ---
//returnResults = logErrorsList[logErrorsList.length-1]
returnResults = logList.join("\n");
var bbeApp = Application("BBEdit");
bbeApp.activate();
var oDoc = bbeApp.TextDocument().make()
//oDoc.text = logList.join("\n");
//--- Output Only Abnormal Log Entires ---
oDoc.text = logErrorsList.join("\n");
//~~~~ END TRY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} catch (oError) {
console.log(oError);
returnResults = "[ERROR]\n\n"
+ "SCRIPT: " + ptyScriptName + " Ver: " + ptyScriptVer + "\n"
+ "Error Number: " + oError.errorNumber + "\n"
+ oError.message
} // END catch
//~~~~ END TRY/CATCH BLOCK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
return returnResults
})();