Author Topic: Free memory is shrinking  (Read 139 times)

Offline tinman

  • Full Member
  • ***
  • Posts: 139
  • Karma: +6/-0
Free memory is shrinking
« on: June 21, 2018, 01:07:23 pm »
I've noticed that free system memory (as reported by the 'free' command) decreases by about 6Mb per hour. I suspect that once it crosses some minimum amount the system will reboot. This seems like some sort of anomaly. Is this typical and expected?

Online akbooer

  • Master Member
  • *******
  • Posts: 5971
  • Karma: +258/-69
  • "Less is more"
Re: Free memory is shrinking
« Reply #1 on: June 21, 2018, 01:21:24 pm »
Quite standard.  See some explanation here: http://forum.micasaverde.com/index.php/topic,47176.msg312736.html#msg312736

Garbage collection runs from time to time and frees it up.  Free memory is not necessarily all that is available to the system.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline kwieto

  • Hero Member
  • *****
  • Posts: 587
  • Karma: +22/-12
Re: Free memory is shrinking
« Reply #2 on: June 21, 2018, 03:32:47 pm »
Typically memory is cleaned every couple of hours, but sometimes the clearing process doesn't work for some reason.
If your free memory is continuously decreasing ad don't go up from time to time, you may need to perform clearing manually putting following code into the test lua window:

Code: [Select]
os.execute("echo 3 > /proc/sys/vm/drop_caches")

If problem persist, you can also design a scene to run periodically and check your memory - then if the clearing is needed, perform the maintenance.
Here is my post where I describe how to do it:
http://forum.micasaverde.com/index.php/topic,57870.msg348709.html#msg348709

Offline tinman

  • Full Member
  • ***
  • Posts: 139
  • Karma: +6/-0
Re: Free memory is shrinking
« Reply #3 on: June 21, 2018, 03:56:44 pm »
It seems that Lua is garbagecollecting about every 4 to 6 minutes which is good. Doing os.execute("echo 3 > /proc/sys/vm/drop_caches") does free up memory again.
I'll probably create a scene to do this periodically.
Thanks for the tip.