SamSaffron/memory_profiler
64.7
Adequate · 19 September 2026
661
lines of production code
Ruby
primary language
1
measurement over time
What this system is
This system is a Ruby memory profiling library that provides programmatic and command-line tools to analyze memory usage. It enables users to track allocated and retained objects, including strings, through a flexible API that supports manual start/stop workflows or automatic execution. The tool generates detailed reports with byte scaling and path normalization, accessible via a new CLI interface for direct terminal usage.
Features
Add executable CLI entry point for memory\_profiler
A new executable script at bin/ruby-memory-profiler has been added, allowing users to run the memory profiler directly from the command line. The script sets up the load path to include the lib directory, requires the memory\_profiler gem, and delegates execution to the MemoryProfiler::CLI interface, passing command-line arguments.
bin · high confidence
MemoryProfiler 1.1.0 introduces CLI, autorun, and refined reporting
The library has been updated to version 1.1.0, introducing a new command-line interface (CLI) via \lib/memory\_profiler/cli.rb\ that allows profiling Ruby scripts or running commands directly from the terminal with options for output files, color control, and file filtering. An \autorun.rb\ script is now provided to automatically start profiling and print results on exit when the library is required. The core reporting engine has been refactored: the \Reporter\ class now exposes explicit \start\ and \stop\ methods for programmatic control, and the \Results\ class has been expanded to track both memory size and object counts separately, with new capabilities to report on retained and allocated strings. Additionally, the output formatting now supports byte scaling (e.g., kB, MB) and path normalization for cleaner reports.
_lib/memory\profiler · high confidence
Behavioural changes
Add start/stop API and refactor report method
The library now supports a manual start/stop workflow via new \MemoryProfiler.start\ and \MemoryProfiler.stop\ methods, allowing users to control when profiling begins and ends rather than relying solely on the block-based \report\ method. The existing \report\ method has been refactored to delegate to \Reporter.report\ and now accepts an options hash, while the main library file has been expanded to require additional internal modules (helpers, polychrome, monochrome, top\_n, stat, stat\_hash) and the CLI.
lib · high confidence
Drops support for Ruby versions older than 3.1
The gem now requires Ruby 3.1.0 or later, removing support for all earlier versions (including 2.1, 2.2, 2.3, and 2.4). Users on older Ruby versions must continue using an earlier release of the gem.
(repo-wide) · high confidence
Test coverage
Expanded test coverage for CLI, reporting, and edge cases
Added comprehensive tests for the new Command Line Interface (CLI) capabilities, including options for class filtering, file ignoring/allowing, output redirection, color control, and path normalization. Introduced dedicated test suites for the public and private start/stop APIs to verify reporter lifecycle and exception handling. Added tests for the Results API to validate byte scaling and path normalization flags, and extended reporter tests to cover edge cases such as BasicObject, anonymous classes, and non-standard class name reporting.
test · high confidence
Dependencies
Update Ruby requirement to 3.1+ and adjust gemspec metadata
The memory\_profiler gem now requires Ruby 3.1.0 or later, dropping support for older versions. The gemspec has been updated to explicitly list the executable as 'ruby-memory-profiler' and define the file set to include the README, CHANGELOG, and license. Additionally, a changelog URI has been added to the gem metadata, and development dependencies (rake, minitest) have been moved to the Gemfile, with a new test fixture gem 'longhorn' added for testing purposes.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 65.
Lenses
- Code Health 100
- Architecture 69
- Maturity 53
- Readiness 67
- Security 99
Changes since last survey
- 273 commits — 248 feature/other, 25 fixes
By area
- lib/memory_profiler — 111 commits
- (repo) — 69 commits
- (root) — 62 commits
- .github/workflows — 12 commits
- test/test_reporter.rb — 10 commits
- test/test_helpers.rb — 3 commits
- test/test_results.rb — 2 commits
- bin/ruby-memory-profiler — 1 commit
- lib/memory_profiler.rb — 1 commit
- test/test_cli.rb — 1 commit
- test/test_reporter_private_start_stop.rb — 1 commit
Notable commits
- fix: BUGFIX: incorrectly only triggering young gen collection, collect old gen as well
- fix: BUGFIX: ugly hacks for RVALUE_SIZE, no longer needed
- fix: FIX: cli not working on old rubies
- fix: FIX: compact in case nil is passed in for some reason
- fix: FIX: correct memsize skew due to side effect freezing of strings
- fix: Fix CI badge
- fix: Fix bug where it would crash if location was nil
- fix: Fix cli for old rubies
- fix: Fix normalize_path and guess_gem to support Ruby 3+
- fix: Fix tests
- fix: Fixes #28
- fix: Merge pull request #10 from mispy/bugfix
- fix: Merge pull request #104 from ooooooo-q/fix/readme
- fix: Merge pull request #117 from fatkodima/fix-tests
- fix: Merge pull request #122 from fatkodima/fix-ci-badge
- fix: Revert "Add Ruby 3.0 to the tests"
- fix: Revert "Add switches to work around missing +'string' support before ruby 2.3"
- fix: bug fixes and general interface cleanup, added pretty print as well
- fix: compensate for api bug, allow io for pretty print ensure topn is always sorted
- fix: fix :allow_files check and ensure all rubygems allocations are attributed correctly
- …and 253 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
SamSaffron/memory_profiler was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit da9107dc340cf3a29b0e122e015bcc3cc7928709 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.