tlkh/asitop

Memory leak if asitop kept running for a few minutes

Opened this issue · 2 comments

If asitop is kept running for a while it will eventually consume all of the memory on the system, showing in Activity Monitor as Python. Even after a few minutes the memory usage steadily increases from 30MB to a few GB according to the "Real Memory"

I am noticing this behaviour too.

Noticed this too, I had a look at the source code, and I think this should work:
sudo asitop --max_count 600

This forces PowerMetrics to restart after X polls.

600 can of course be any integer value. That would force a restart at around 10 minutes given the poll time is 1s. Moving it lower might be desirable (although there is a small trade off in the PowerMetrics reboot time/cost if taken to an extreme).

The default value is 0, which will in effect cause the Powermetrics data to grow infinitely, which will have the following effects:

  • Large temp files.
  • Unbounded/increasing memory usage
  • Increased CPU usage