28757, "ShreyasKhandekar", "[Feature Request]: 'memoryHighWaterMark()' in the MemDiagnostics module", "2026-05-01T00:13:56Z"
Summary of Feature
Description:
MemDiagnostics has memoryUsed() which returns current Chapel-managed allocation in bytes, but no equivalent for peak/high-water mark. printMemAllocStats() prints "Allocation High Water Mark" but doesn't return it as a value. I need the HWM as a returnable value to log alongside other metrics at runtime.
Is this issue currently blocking your progress?
No. Workaround is calling printMemAllocStats() and using my eyes to read the annoyingly long number because its in bytes.
Code Sample
use MemDiagnostics;
// What I'd like:
proc memoryHighWaterMark(): uint(64);
// Usage:
coforall loc in Locales do on loc {
writeln("Locale ", here.id, " Chapel HWM: ", memoryHighWaterMark() / (1024*1024*1024), " GB");
}
Implementation Notes
The runtime has maxMem in chplmemtrack.c so its just a matter of making it available:
- Add
chpl_memoryHighWaterMark()to the runtime (returnmaxMem) - Add
memoryHighWaterMark()proc inMemDiagnostics.chplcalling the runtime function - Same
--memTrackrequirement asmemoryUsed()?