PLEG memory usage reduction


Ok so starting a new thread on this having done more troubleshooting. Issue was Luup restarts. A rebuild and buildup later, I started getting them again, when building up my PLEGs. suspecting memory issues, I moved logging to USB and did a few more general tweaks and have things reasonably stable now, but I am down to about 12Mb free memory and I noticed that each time I add more PLEG Conditions, this seems to drop more. That is consistent with the behavior I was seeing seemingly starting when I added new conditions, so I suspect they were just tipping Vera’s memory over the edge. Where is PLEG’s memory footprint in the main - ie, is it in conditions, inputs or actions (if anything in particular) and are there any types of inputs, conditions or actions that are more memory intensive than otheres? Any strategies I can use to reduce it?

Edit - Since writing, I have been monitoring memory usage and it was gradually dropping. Strangely, over about 30 mins it drops down gradually until it bottoms out at about 2Mb free, then it seems to start rising again and then hovers around 3Mb. Buffers apparently continues to grow after memory bottoms out. I can not see any memory leak errors. I can only think that one of my conditions is causing this. I know the only way to be sure is to remove things from PLEG and build back up, but as I have 3 large PLEGs I need to try and at least narrow it down… If I just bypass the PLEG, is that a good enough test to see if one of the 3 I have is causing an issue, or will it continue to evaluate conditions but just not fire actions when bypassed? I have added something at the start of each condition to stop it firing when a multiswitch is set, but not sure that is enough to be sure.

I have raised a ticket with MCV, but I guess they will want to start deleting plugins.

I try not to use NOW in any of my PLEG conditions since I noticed an improvement in my system when I replaced allot of them with schedules.
I can not say for sure that this helps or was it only a coincidence in my case.

I did try removing NOW from all the conditions but does not seem to be making a difference. Thanks for the suggestion though :wink:

My understanding is that if you have NOW in your condition the condition will be evaluated once every minute so if it does not need to be evaluated every minute I guess it does not use as much resources. But like I said it might have been a coincidence in my case because I did allot of things to free up memory so it might have been something else.

Also if you have deleted devices or plugins you might want to do some real hard reboots of the vera. I think some kind of cleanup is done when you do a hard reboot.

I rebuilt from scratch the first time it started so it shouldn’t be an issue with old devices or plugins. I found on another thread something about garbage collection causing a drop then spike in memory, so it sounds like the behaviour is normal. Looks like I am going to have to upgrade to a vera3 or just start prioritising what I put into Pleg a bit more. Even though it drops to 3mb it’s still quite stable now. I was hoping there might be some other best practice or strategies I could use to reduce the memory footprint but looks like I already did that.