How to Generate a Memory Leak in the Keyboard Maestro Engine

OK, sounds good.

Can you upload one of those “stubs”?

Ok sure. Sec...

You could also upload it here. No need to make a new topic.

1 Like

Yes, but I find the method for posting on existing threads confusing! I know it was explained to me but it's an unnatural method which I keep forgetting. I'll try again.

Just drag the macro into the editor field of the browser.

∆ Move Mouse to Absolute Position [x],[y]

Ok I just dragged a macro from KM Editor into this browser. I don't think it worked, let's see....

Sorry, an exported macro, I meant.

Export the macro to somewhere (e.g. Downloads folder) and drag it from the Finder.
“Export” is in KM Editor’s File menu.

Ok how about this. Seems to have worked.

∆ Move Mouse to Absolute Position [x],[y].kmmacros (2.1 KB)

Here's a larger stub.

∆ Type [key].kmmacros (31.2 KB)

Could you also upload the trigger macros? (The macros that pass the %TriggerValue%s)

I don't have any trigger macros. I haven't run anything yet. Well, sometimes to debug I might click on the Try button but for the most part I haven't even tested these macros yet.

Is this also the case in normal mode?

Well, in Normal Mode I can get the memory leak just by clicking Enable/Disable group. So that should be evidence that it's not running any macros. Even when the macro group was empty, as I reported. But it may indeed me that the leak is faster when I'm executing things. I can't be sure right now.

As we've ben talking for 15 minutes the memory allocation has dropped from 500 MB to 252 MB. I'm not sure what to think. If I keep editing instead of chatting on a web browser, it may go back up again.

Well, 500MB is much, but not really a big thing. If I recall correctly, in normal mode you could raise it to several GBs, right?

Try to achieve this in safe mode.

I am eager to see what happens as I use the Editor in Safe Mode. TTYL.

Yes in Normal Mode iI tend to see 300 MB after, perhaps, a couple of hours, and if I'm really not paying attention it can reach 3GB or 5GB easily enough. The system usually becomes non-responsive after 3GB. But I think I've seen 8GB.

Stub for Send Mail. I meant to post this on the Macros forum but erred. This is not a tested macro, it's just for troubleshooting a memory leak.

∆ Send Mail [email]-[subect]-[text].kmmacros (2.1 KB)

Stubs for Scroll action

∆ Scroll [left|right|up|down] [amount].kmmacros (3.7 KB)

I'm going to upload a couple of stubs I recently created for KM. This is only meant for troubleshooting a memory leak I'm having. These stubs were NOT tested.

I guess I should call them "Stubroutines" LOL!

Just Share to the Forum, then select all and copy and then cancel the post and then reply and paste that in as normal.

Replicated how?

In Safe mode, what do you need to do to cause the memory leak?

Another debugging method you can use is:

  • Create a new user account
  • Turn off auto-login if it is on
  • Reboot in Safe mode
  • Reboot and lot in to the new user account
  • Verify the issue there

A new user account will still share some installation settings with the original user, but will have a lot cleaner environment, and that may help.

Safe mode is not really a mode to be working in, but I don't know why you are having such problems with the Speak Text action - it is possible speech doesn't work in Safe Mode, but I would be surprised.

The answer to "how" is just creating macros in the editor. Generally I was clicking on the + to add a new Macro, then I clicked on the + to add a new action, then I filled in the fields in the action. I'm just typing new macros and actions into the editor. Perhaps I did click "Try" occasionally to see if an action was syntactically correct. But I certainly wasn't running anything significant. I never saw anything in the Debugger running. Although my macro groups are mostly enabled and it's theoretically possible something was triggered. I guess I should go disable the groups again.

I like your idea of a new account. I think I'll try that.

It doesn't bother me that Speak Text isn't working in Safe Mode. Life is filled with little anomalies.

Here are my results from the last hour or two of typing. The KM Engine has been typically hanging at around 480 MB. However it has occasionally spiked as high has 830 MB. But it tends to bounce back (to 480) within a couple of minutes.

But right now the KM Editor is feeling very very sluggish. As if I was running in Normal Mode with 3 GB of RAM allocated to the engine. I really think I have to restart that Engine. I might as well, since it's having around 480 MB now. I'll also disable all my macro groups, except for a small one that I'm testing with.