High memory usage in KM 7

I noticed when looking through Activity Monitor that KB Maestro Engine process was using 1.5 GB (gigabytes) of RAM.

This seems excessive to me. I quit & restarted the KBM Engine process and indeed RAM usage dropped to 35MB (megabytes).

Can the author or other informed people comment on why KBM Engine would consume so much RAM? Is this heavily influenced by the type of macro functions I use, or is it possibly a memory leak in the code?

I typically use KBM macros lightly, maybe 8 or 10 custom macros, mostly pretty simple, doing things like copy-pasting the current date. I do also have a macro to switch Fujitsu ScanSnap profiles. System up time in this case was about 9 days.

Other relevant data about my system:

Mac Mini 2012 / 16GB RAM / Yosemite 10.10.5 / KB Maestro 7.0.3.

That's quite high. I have not seen anything near that.
Currently mine is at 231MB.

Don't know for sure, this is just a thought/guess, but do you have a lot of large saved KM Clipboards and/or variables?

As a general practice, at the end of each macro, I clear saved Clipboards and Variables I have use, but not longer need:

Things that use a large amount of memory are:

  • Very large clipboards
  • Very large variables.
  • Image actions
  • Memory leaks.

If you can narrow down the buildup to particular actions, then perhaps it is a memory leak I can plug.

Otherwise, it is very hard to find memory leaks without a reproducible case.

Hmm. You know what it may be. I use Vectorworks, a professional CAD / 3D rendering package, and I regularly copy / paste large objects (i.e. 3D symbols with 1000’s of polygons, textures, etc.) to / from the clipboard. I wonder if at some point KB Maestro got, or gets, caught in the cross fire as it were, and ends up with one more copies of these giant clipboard objects sucked into KBM’s memory space.

I do have a couple of macros that interact w/ the clipboard. I will review my config and usage patterns carefully and follow up if & when I identify the cause, either self-induced through my macro programming, or possibly an actual memory leak.

Keyboard Maestro keeps a clipboard history, so if you have large numbers of large clipboards, it can mount up quite a lot.

There are preferences described in the Documentation that can limit the clipboard size, such as:

You can set the maximum number of items in the clipboard history (default 200)

defaults write com.stairways.keyboardmaestro.engine MaxClipboardHistory -int 200

You can set the maximum clipboard flavor size (default 100MB)

defaults write com.stairways.keyboardmaestro.engine ClipboardFlavorMaximumSize -int 100000000

Peter, is there a way to just remove the current System Clipboard from the clipboard history?

I'm think about a case where I have a very large System Clipboard that I do NOT want to keep in my KM Clipboard History.

Not Peter, but what I’m doing in this case is opening the Clipboard History panel and deleting it from there (⌫key).

1 Like

Hey JM,

Another option would be to set the clipboard to "".

-Chris

1 Like

Delete Current Clipboard.

1 Like