Restarting automatically to clear ram consumption

After running a macro for a few hours, my application usually ends up consuming like some ridiculous amount of ram, 22 GB, and probably fails at some point.

Then I have to manually close the keyboard maestro program, start it over again, and begin the macro again.

Might there be a way to automate this? I'm running keyboard maestro within a virtual machine mac on my computer.

Which application is consuming RAM, the Keyboard Maestro Engine? A KM macro could potentially stop its own engine, but when the engine is stopped, starting it up again has to be done outside the engine, which is possible, and I've done it, but I'm not quite sure if you are taking about the Engine or not.

Last year I had an M1 Mac with 8GB RAM, and I had the same problem daily (though it didn't usually go as high as 22GB, usually just 4GB) but now that I'm using an M3 Mac with 24 GB RAM, the problem has diminshed quite a bit, but I still reboot the KM Engine daily to reduce its RAM consumption.

That sounds like a very broken macro!

When your car is leaking so much oil that you have to add a quart a week, maybe automating an oil injection system isn't the way to go :blush:

3 Likes

Not necessarily -- IIRC there's a memory leak problem with some system API calls which we don't notice under "normal" KM use but can be an issue in some otherwise "perfect" macros. I think someone had a problem with either "Insert text by typing" or "Type a keystroke" but it only became an issue after tens of thousands of repetitions, like when botting a game for a few hours.

But I agree -- better to fix the actual problem if possible!

@mikespax -- assuming it is the KM Engine that you are referring to, check your macro carefully and make sure it isn't doing something unexpected like continually appending to a variable, spawning extra instances that are taking up space, leaving shells open, or similar. But if you have to go with the "restart the Engine" method then take a look at this post (and the rest of the thread, for context).