Skip to content

fix(dev-admin): report current memory, not the peak, without psutil - #316

Open
M1gael wants to merge 1 commit into
v3from
fix/dev-admin-current-memory
Open

M1gael wants to merge 1 commit into
v3from
fix/dev-admin-current-memory

Conversation

@M1gael

@M1gael M1gael commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

What was wrong

Without psutil installed, the dev admin showed peak memory as current memory. /__dev/api/status memory_usage_mb and /__dev/api/system memory_mb (the dashboard's Memory figure) both carried the peak resident set size, so a server that grew once and freed the memory kept showing the high-water mark.

Measured on v3 after allocating and freeing 150 MB: both fields 184.66 MB, kernel VmRSS 37.3 MB.

What changes

  • Current usage comes from psutil when installed, else from VmRSS in /proc/self/status (Linux, Android).
  • Where neither is available (macOS, Windows without psutil), /status keeps its 0.0 fallback and /system its None. The peak is never reported as current usage.
  • peak_memory_mb is unchanged.

After the change, same scenario: 38.3 MB against VmRSS 38.3 MB.

Tests

Three new tests in tests/test_dev_admin.py; all fail on v3 and pass here. Full suite: the same 9 failures before and after.

Not run

macOS and Windows paths were read, not executed.

Without psutil, /__dev/api/status memory_usage_mb and /__dev/api/system
memory_mb both carried the peak resident set size, so a server that had
grown once and freed the memory kept showing the high-water mark as its
current usage. Current usage now comes from psutil when installed, else
from VmRSS in /proc/self/status. Where neither is available the status
field stays 0.0 and the system field None; the peak is never reported
as current usage.

Signed-off-by: Michael <michael@codeinfinity.co.za>
@M1gael

M1gael commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator Author

I have read the Tina4 Contributor Licence Agreement and I agree to it.

@M1gael M1gael closed this Nov 16, 2026
@M1gael M1gael reopened this Nov 16, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants