Memory Hog

Every few days I get a notice that I'm running low on memory. When I check Keyboard Maestro Engine is using 8 to 12 GB of RAM. I do have 16 GB of RAM.
Is there a cure, other than quitting and restarting Keyboard Maestro. This has been going on for years...

Could it be the cruft from KM macros that didn't end? (That, I think, might also tie up CPU - depending on what they're doing.)

The worst culprit is steps that pause for some condition that never arrives.

My method is:

  1. Use File -> Quit Engine to stop the engine.
  2. Use File-> Launch Engine to restart it.

I rarely have to do this.

Martin,

Either me or my computer doesn’t understand your example "Use File -> Quit Engine to stop the engine.”

I tried the Action "File, Folder or Application".

There must be some other part that's not obvious to me.

Definitely not normal, I've rarely seen my install of KM use more than 300MB. What KM version are you using?

File -> Quit Engine

Screen Shot 2020-09-07 at 3.30 PM

and then Start it again (it will say Start instead of Quit)

Hi,

Version 9.9.6

Don’t see screen shot??

How does KM know where/what it’s starting and quiting?

Launch the Keyboard Maestro Editor from the menu bar and look in the Editor's File menu. The Editor knows what the engine is up to.

@MartinPacker and @rpoland,

You guys might find this easier to restart the KM Engine:

TIP: How To Launch or Restart KM Engine Without Using KM

@rpoland, my suggestion was based on the assumption you were in the Keyboard Maestro Editor application.

1 Like

Hi,

Now that I have stumbled through all the suggestions and assumptions and have a solution, how about some suggestions on finding the Macro(s) that are not closing properly.

click the KM icon at the top right, next to the WiFi and Bluetooth, it will flash if it's running something. Click it and it will list all running macros

1 Like

If you are referring to the KM menu/icon in the Apple Menu bar,I don't see "running" macros, only "active" macros available to be executed.

Also, it's position in the menu bar is dependent on how each Mac loads these menus. In my case it is no where near WiFi or Bluetooth.

2 Likes

Presumably one could make an action to do the “Cancel”. And possibly run it in the middle of the night.

I would already be interesting to see the results if the @rpoland did the above mentioned “Cancel all macro’s” option.
Is the memory usage dropping?
If so, then there probably are some “hanging/running macro’s”...

Yep.

I've had this macro for years, and it's saved my bacon a few times when I realized a macro I was testing was running waay too long. Sometimes these were benign, but a couple of times I could have trashed my hard drive if I hadn't reacted quickly.

The keyboard shortcut is well mapped into my muscle memory now.

-Chris


Kill All Macros.kmmacros (4.1 KB)

2 Likes

Chris,

I downloaded your macro . I enabled and ran it and also ran only the command. KM is still using 6.26 GB of ram.

As a further effort, I ran “Cancel all macros", No effect.

AND looking at the Menu bar Icon/Running shows no macros and only normal apps.

Hey Bob,

Yuck...

What happens to your memory when you quit and restart the Keyboard Maestro Engine?

What's the result of this script?

tell application "Keyboard Maestro Engine"
   set variableCount to ((get count of variables) as text)
end tell

set clipText to "Count of KM Variables: " & variableCount

set the clipboard to clipText

Run this macro:

Keyboard_Maestro ⇢ Troubleshooting ⇢ Dump the Environment to a File with set.kmmacros (4.9 KB)

Zip the file created on the ~/Desktop and sent it to me personally. Do NOT post it to the forum.

Use my scriptmeister@thestoneforge.com address.

How large is this file in the Finder?

~/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite

The Running menu only applies to applications – not macros.

-Chris

Maybe it's related to macro...
does this memory ballooning happen after running a certain macro?

This issue occurs at random and some days apart.