diff options
Diffstat (limited to 'ram-widget')
-rw-r--r-- | ram-widget/ram-widget.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ram-widget/ram-widget.lua b/ram-widget/ram-widget.lua index 867d28e..970c2d6 100644 --- a/ram-widget/ram-widget.lua +++ b/ram-widget/ram-widget.lua @@ -59,6 +59,8 @@ local function worker(user_args) return math.floor(value / (total+total_swap) * 100 + 0.5) .. '%' end + local reset_garbage_collector = 0 + watch('bash -c "LANGUAGE=en_US.UTF-8 free | grep -z Mem.*Swap.*"', timeout, function(widget, stdout) total, used, free, shared, buff_cache, available, total_swap, used_swap, free_swap = @@ -77,6 +79,11 @@ local function worker(user_args) {'buff_cache ' .. getPercentage(buff_cache), buff_cache} } end + reset_garbage_collector = reset_garbage_collector + 1 + if (reset_garbage_collector > 9) then + collectgarbage() + reset_garbage_collector = 0 + end end, ramgraph_widget ) |