'Tictoc'-Style Memory Usage Tracking
Overview
Provides simple start/stop memory tracking functions tic_mem() and toc_mem() that can be nested, inspired by the 'tictoc' package. Track RAM usage during code execution with support for logging, custom messages, nested tracking blocks, and parallel worker monitoring. Features continuous background polling to estimate peak memory usage across main process and workers. Integrates with the 'future' package ecosystem for automatic worker detection. Designed for monitoring memory consumption in parallel workflows.
CRAN resubmission
- Replaced commented-out help examples with small, executable examples and regenerated the documentation. Logging examples now run in ordinary checks.
- Restored temporary checkpoints so background polling returns its samples; nested monitors use separate files, removed by
toc_mem()ormem_clear(). - Include start/end observations in the reported peak when polling is enabled.
- Added regression tests for nested sampling, cleanup, and peak bounds.
- Removed the inaccurate Windows system requirement and clarified sampling and temporary-file recovery limitations.
Pre-CRAN development history
The development labels below predate the initial CRAN submission (0.1.0).
memtoc 0.4.0
Show all changes in 0.1.1Hide the rest of the changes in 0.1.1
Additions
- Added vignette.
- Added NEWS.md changelog.
- Package passes R CMD check with no errors or warnings.
memtoc 0.3.1
Bug Fixes
- Fixed background monitor sample retrieval on Windows. The monitor now saves checkpoints on every sample and reads from the persistence file when the background process is terminated.
- Fixed test script using unexported
format_bytes()function.
memtoc 0.3.0
New Features
- **Parallel worker monitoring**: New
workersparameter intic_mem()allows monitoring memory across parallel workers from thefuturepackage ecosystem. workers = "auto": Automatically detect future workers and child processesworkers = "none": Only monitor the main R processworkers = "children": Monitor main process and all child processes- Integer vector: Explicit list of PIDs to monitor
- **Per-worker statistics**: Results now include
worker_statsdata frame with peak memory usage for each monitored process. - **New function
mem_parallel_info()**: Diagnostic function to check parallel backend status and detected workers before running a job. - Results now include
n_workersfield showing number of worker processes monitored.
memtoc 0.2.0
New Features
- **Background polling**: New
intervalparameter intic_mem()enables continuous memory sampling via a background R process. This captures true peak memory even for short-lived allocations. - **Memory trajectory**: Results now include a
trajectorydata frame with timestamped memory samples when background polling is enabled. - **System memory context**: Trajectory includes system-wide RAM usage (
sys_total,sys_avail,sys_percent). Warnings are displayed when system RAM exceeds 80% or 95%. - **CPU time tracking**: Results include
cpu_userandcpu_systemfields showing CPU time consumed during the tracked interval. - **Crash recovery**: New
mem_recover()function retrieves memory samples from a crashed R session using persisted checkpoint files. - **Capability detection**: New
mem_capabilities()function checks which features are available on the current system. - **Diagnostics**: New
mem_diagnose()function provides detailed troubleshooting when background polling is unavailable.
memtoc 0.1.0
Initial Release
- Core
tic_mem()/toc_mem()functions for start/stop memory tracking. - Nested tracking support with proper stack management.
- Logging with
mem_log(),mem_clearlog(), andmem_print_log(). - Human-readable output with peak memory, current memory, and elapsed time.
- Print method for result objects showing detailed breakdown.
From NEWS.md in the release
Install
Health
- OK13 OKNow
- OK6 OK2026-09-27
Documentation
- Help pages
- 12 (1 internal)includes a package overview page
- Examples that run
- 100%10 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
Stars over time
5 development-tooling and community-health practices detected across 3 families in the upstream repository
Checks run against github.com/jcoa05/memtoc on 2026-10-11.
The R CMD check workflow runs on Windows
Dependencies
Code & Tests
People & History
- 0.1.1Latest2026-09-26 · current release
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-09-26
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Download size
- 46 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("memtoc")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-17, which the citation names so these numbers can be found later. More on citing and the projects behind them.