Memory meter counts page cache as used memory under a cgroup limit
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- linux, typescript
- Domain
- performance
Research direction
Start in src/vs/platform/positronMemoryUsage/node/positronMemoryUsageUtils.ts at getSystemMemory() and read the macOS branch, which already discounts inactive and purgeable pages, as the pattern to mirror. Parse inactive_file / total_inactive_file from memory.stat (falling back to the current calculation when it is missing), then check how positronMemoryUsageService.ts turns the free value into the meter and the low-memory warning. Done looks like the example container reporting roughly 980 MB of 2.5 GB used and no warning.
Written by the indexing model from the issue text.
Description
Summary
On Linux with a cgroup memory limit (for example, a Docker container or a Kubernetes pod), the memory meter in the Variables pane counts reclaimable page cache as used memory. As a result, the meter shows much more memory in use than the real working set. The low-memory warning can show when there is no memory pressure. The extra memory goes into the "Other" bucket, so it looks like an unknown process uses most of the container's memory.
We got this report from @mine-cetinkaya-rundel, who teaches with Positron Server in hosted containers. Students who see a large "Other" value look for a runaway process that doesn't actually exist.
Example
Positron Server 2026.08.1 in a Docker container with a 2.5 GB limit (cgroup v2). Fresh R session, no objects loaded.
The meter showed:
| Category | Reported |
|---|---|
| Positron total | 982.75 MB (38%) |
| Other | 1.42 GB (57%) |
| Free | 124.91 MB (5%) |
The low-memory warning was visible.
The cgroup contained:
memory.max 2684354560
memory.current 2613657600
anon 694161408
file 1788030976
inactive_file 1633513472
active_file 154517504
kernel 125603840
Most of memory.current is page cache, and most of that cache is inactive_file. The kernel reclaims inactive_file before it enforces the limit, so this memory cannot cause an OOM kill. A process listing showed only Positron processes. The working set (memory.current - inactive_file) is about 980 MB, which is 37% of the limit.
Cause
getSystemMemory() in src/vs/platform/positronMemoryUsage/node/positronMemoryUsageUtils.ts calculates free memory as the limit minus memory.current (cgroup v2) or minus memory.usage_in_bytes (cgroup v1). Both values include page cache. Each file that the container reads or writes (the Positron install, extensions, R and Python libraries, temporary files) adds to this value.
positronMemoryUsageService.ts then puts all memory that is not Positron into "Other". The low-memory check uses the same free value.
The macOS path in the same file already counts inactive and purgeable pages as free memory. The Linux cgroup path does not do the same.
Proposed fix
Subtract inactive file cache from usage. This is the calculation that docker stats and the Kubernetes container_memory_working_set_bytes metric use.
- cgroup v2:
used = memory.current - inactive_file(frommemory.stat) - cgroup v1:
used = memory.usage_in_bytes - total_inactive_file(frommemory/memory.stat) free = limit - used
If memory.stat is not available, keep the current calculation.
With this change, the example session shows about 980 MB used of 2.5 GB, and the low-memory warning would not show. "Other" decreases to about zero. Process RSS includes some file-mapped pages, so "Other" stays an estimate.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 207
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 308
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from posit-dev/positron
-
area: assistant area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
accessibility area: plots area: ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: plots area: ui bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area: kernels lang: r
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
posit-dev/positron#17575 · 2 comments ·
Maintainers usually reply within 1 day
-
area: remote host bug support
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
posit-dev/positron#17249 · 1 comment ·
Maintainers usually reply within 1 day
All issues in posit-dev/positron
Similar issues
-
triage
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
novuhq/novu#13613 · 2 comments ·
Maintainers usually reply within 1 day
-
enhancement from-app needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nightly-labs/openbot#23943 ·
Maintainers usually reply within 1 day
-
comp/desktop desktop/chat P3 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
NousResearch/hermes-agent#164451 ·
Maintainers usually reply within 1 day
-
shortkeys-2188:ready
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
crittermike/shortkeys#1121 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Doist/todoist-cli#742 ·