Bug: [Excessive RAM usage reported by tmux_ram_info.sh
plugin]
#321
Labels
bug
Something isn't working
tmux_ram_info.sh
plugin]
#321
Bug: [Excessive RAM usage reported by
tmux_ram_info.sh
plugin]Describe the bug
The
tmux_ram_info.sh
plugin shows an excessive RAM usage when nvim is open that does not match the actual usage.Which does not match the ram that my system is using.
To Reproduce
Steps to reproduce the behavior:
tmux_ram_info.sh
scriptNote: The plugin seems to work fine, but when using
nvim
withlazyvim
, it does not count the processes correctly.Expected behavior
The script should report accurate RAM usage.
System
Possible solution
I found a possible solution but I would like to discuss it before making a PR. The original code on line 74 does this:
total_mem_kb="$(ps -o rss= -p "$pids" | paste -sd+ - | bc)"
So I changed it to this:
total_mem_kb="$(ps -o rss= -p "$pids" | awk '!seen[$0]++' | paste -sd+ | bc)"
Which shows me a better representation:
When I run the command
pstree -p "$pid"
with the tmux PID, it shows a tree with multiple processes having different PIDs:And when extracting their sizes in bytes using
ps -o rss= -p "$pids"
it give us this result:However, it appears that we should not sum all of them because some PIDs are repeated. My solution was to sum only the unique values to
total_mem_kb
, but I am not sure if it's the best solution for this bug.The text was updated successfully, but these errors were encountered: