DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

zuosus /

zuosus/dsh-tmp-memdisk

Verified

This plugin has no description yet.

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@c7574c10

Temp disk guard hero

Temp disk guard

1. What problem it solves

I ran the tests again and again, and every run left a pile of temporary files behind. I never cleaned them up, and never had to — until one day I noticed the disk was almost full: over 50 GB of junk, the volume at 92 %, only about 17 GB left. The machine had become painfully slow and close to unusable. That mess was almost entirely my own test runs, and macOS only clears that folder on a reboot or after three days of inactivity — so it kept growing far faster than the system could reclaim it.

This plugin keeps it from happening again: whatever can go into memory does, whatever escapes is swept away regularly, and before memory fills up its contents are moved out to disk. The disk keeps its breathing room and the machine stays responsive.

2. The idea behind the solution

Three layers, each covering what the previous one misses:

  1. Redirect — send temporary output to a dedicated RAM disk. Most build and test files land in memory and disappear when the process exits.
  2. Reap — some programs ignore this and still write to the system temp directory. A timer sweeps the stale leftovers from there into a holding area.
  3. Supervise — a RAM disk has a fixed size, and filling it fails the build. A background watcher tracks usage, warns when it runs high, and drains the contents to disk when idle to free space again. A line under Workspaces in the left sidebar keeps showing "{name} used {pct}%" live, refreshed every couple of seconds; it is display only and can be turned off in the settings.
writes ──▶ RAM disk ──▶ drained to disk when nearly full
   └─────▶ system temp dir ──▶ swept on a timer

Redirect handles the vast majority of writes, reap catches the stragglers, and supervision keeps the RAM disk from ever filling up.

Reclaim rules: by age, never by "is anyone writing"

Entries on the RAM disk live or die by age alone. That rule comes out of two 2026-12-01 experiments (see DECISIONS):

Entry state Action Why
Untouched for reapAgeMinutes (default 10) and no fresh child file May be moved out This is what a finished test run leaves behind
Written recently (including child files) Never moved A running build/test owns that directory; moving it makes it fail with ENOENT
Over the watermark but nothing is stale Do nothing, report no-stale When everything is fresh, the only correct action is to leave it alone

Draining no longer waits for "idle": above the watermark it moves stale entries only, and stops at LOW_PCT (default 40%). Leftovers are also reaped routinely (a batch once 100 stale entries pile up, independent of the watermark), otherwise they never get drained at 20% usage. Whatever is moved lands in the spill directory, which now has its own GC: 7-day retention and a 2048MB cap, oldest first.

The guard script now lives in the repo as daemon/tmpguard.sh (since 2026-12-01; before that it only existed under $DSH_HOME/plugins/dsh-tmp-memdisk/daemon/, where changes were never reviewed).

3. Supported platforms

The plugin detects the runtime environment and picks the right RAM-disk tool automatically — there is nothing to configure by hand:

Platform Tool used What "RAM disk" means here Requirements
macOS hdiutil + diskutil APFS RAM disk (ram://N) none
Linux mount -t tmpfs a tmpfs mount sized in MB root / CAP_SYS_ADMIN
Windows ImDisk Virtual Disk Driver a virtual-memory disk on a drive letter ImDisk installed + elevated session

On Linux the plugin creates a tmpfs under a DSHTmp-prefixed directory; on Windows it creates an ImDisk -t vm disk with a DSHTmp volume label. The DSHTmp prefix is the same discovery convention used on macOS: after a restart the plugin finds its existing disk by name instead of creating a second one.

If the platform or its required tool is unavailable, disk supervision still works and the RAM-disk management section simply reports why — it never throws or blocks the rest of the configuration page. The plugin does not install kernel drivers for you: on Windows install ImDisk first (choco install imdisk-toolkit), and on Linux run DSH with the privileges needed to mount tmpfs.

—/ 5

No ratings yet

Verified DSH bundle

Commit c7574c10e95e

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout