leakhunt/bin/sample_fleet.ps1
acbot 57b5e43d0e Initial commit — leak-hunt project complete
Five bugs identified and patched in retail Asheron's Call client:
- v3b: palette refcount over-increment (3-byte NOP at two sites)
- v5: RenderSurface PurgeResource no-op stub (vtable slot 2 thunk)
- v11: two dangling-pointer crash guards (NULL-check + reorder)
- v14: CEnvCell::Destroy ClipPlaneList leak (18-byte JMP to cleanup thunk)
- v22: unpacker stale-pointer SEH guard (whole-function __try/__except)

All five ship in leakfix.dll (117 KB, SHA d282f23c…) which is loaded
by acclient.exe at process start via PE import table patching by
tools/install_leakfix.py.

Controlled 15-client fleet soak: unpatched control died at 26h with
palette exhaustion; all 14 patched clients survived past that point
and reached ≥5-day uptime.

Residual ~15 MB/h growth traced to d3d9.dll's internal slab allocator
(260KB surface backing buffers retained after Release). See REPORT.md
§10 for the full investigation; conclusion is that it's unfixable from
outside d3d9.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 21:07:58 +02:00

33 lines
1.4 KiB
PowerShell

#requires -Version 5.1
<#
sample_fleet.ps1
One-shot working-set + private-bytes + virtual-bytes sample for every
running acclient.exe. Appends to artifacts/soak/memtrace_fleet.csv.
Usage:
powershell -ExecutionPolicy Bypass -File bin\sample_fleet.ps1
or schedule via ScheduleWakeup with a recurring 1500-1800s cadence.
#>
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$logDir = Join-Path $root 'artifacts\soak'
if (-not (Test-Path $logDir)) { New-Item -ItemType Directory -Path $logDir -Force | Out-Null }
$csv = Join-Path $logDir 'memtrace_fleet.csv'
if (-not (Test-Path $csv)) {
'ts_utc,pid,start,uptime_h,ws_mb,private_mb,virtual_mb,handle_count,thread_count' |
Out-File -FilePath $csv -Encoding utf8
}
$now = [DateTime]::UtcNow
$procs = Get-Process -Name acclient -ErrorAction SilentlyContinue
foreach ($p in $procs) {
$up = [math]::Round(($now - $p.StartTime.ToUniversalTime()).TotalHours, 2)
$line = '{0:o},{1},{2:o},{3},{4},{5},{6},{7},{8}' -f $now, $p.Id,
$p.StartTime.ToUniversalTime(), $up,
[math]::Round($p.WorkingSet64 / 1MB, 1),
[math]::Round($p.PrivateMemorySize64 / 1MB, 1),
[math]::Round($p.VirtualMemorySize64 / 1MB, 1),
$p.HandleCount, $p.Threads.Count
Add-Content -LiteralPath $csv -Value $line
}
Write-Output ("samples={0} csv={1}" -f $procs.Count, $csv)