Skip to content
CAI
Software that uses CAICheck a score

SamSaffron/memory_profiler

56.6

Adequate · 6 November 2026

661

lines of production code

Ruby

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

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 cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 57 → 57 (-0.0)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 64 → 64 (+0.0)
  • Architecture 69 → 69 (+0.0)
  • Maturity 43 → 43 (+0.0)
  • Readiness 70 → 70 (+0.0)
  • Security 99 → 98 (-0.7)

Resolved (4)

  • Duplicate high-level entry point. Both the main MemoryProfiler type and the Reporter type expose an identical report method signature. It is unclear if MemoryProfiler.report delegates to a default reporter or if they are independent entry points, creating confusion for users on which API to use.
  • Duplicate lifecycle method. Both types expose a stop method with identical signatures, leading to the same ambiguity as start regarding which instance is being stopped.
  • Duplicate lifecycle method. MemoryProfiler.start and Reporter.start appear to perform the same action (starting the profiling session). The difference in arguments (opts vs none) suggests inconsistency in how configuration is handled at different abstraction levels.
  • Inconsistent naming pattern for lookup operations. lookup_location takes file/line and returns location info, while lookup_class_name takes a class and returns a name. While the domains differ, the verb 'lookup' is used for different semantic actions (resolving metadata vs resolving identity).

Written by cca.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 6 November 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.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.2+preprod-5c4e66d9318b.