Pympler

Python memory profiling and object analysis toolkit — measures object sizes, tracks memory over time, and identifies memory leaks. Pympler features: asizeof() for object memory size, muppy for heap tracking and diff, summary.print_() for object type summary, tracker.SummaryTracker for incremental tracking, refbrowser for reference browser, classtracker.ClassTracker for class instance tracking, web interface for browser-based memory analysis, and flat_diff() for memory change detection. More accurate than sys.getsizeof() — includes referenced objects.

Evaluated Mar 06, 2026 (0d ago) v1.0.x
Homepage ↗ Repo ↗ Developer Tools python pympler memory profiling size tracking debugging
⚙ Agent Friendliness
64
/ 100
Can an agent use this?
🔒 Security
83
/ 100
Is it safe for agents?
⚡ Reliability
78
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
78
Error Messages
75
Auth Simplicity
99
Rate Limits
99

🔒 Security

TLS Enforcement
85
Auth Strength
85
Scope Granularity
85
Dep. Hygiene
85
Secret Handling
75

Memory analysis tool that inspects all Python objects. asizeof() may traverse objects containing credentials. Web interface (start_profiler) exposes memory data on localhost — do not expose port externally. Development use only. Output may contain sensitive data from application memory.

⚡ Reliability

Uptime/SLA
75
Version Stability
78
Breaking Changes
80
Error Recovery
78
AF Security Reliability

Best When

Measuring actual memory usage of complex Python objects and detecting memory leaks during development — Pympler's asizeof() gives accurate deep sizes that sys.getsizeof() misses.

Avoid When

Production monitoring (use psutil), CPU profiling (use pyinstrument), or when objgraph's simpler interface is sufficient.

Use Cases

  • Agent object size measurement — from pympler import asizeof; model = load_large_model(); size_mb = asizeof.asizeof(model) / 1e6; print(f'Model size: {size_mb:.1f} MB') — deep size including all references; agent measures actual memory used by complex objects; sys.getsizeof() only measures shallow size; asizeof includes all referenced objects
  • Agent memory growth tracking — from pympler.muppy import muppy; from pympler import summary; before = summary.summarize(muppy.get_objects()); do_work(); after = summary.summarize(muppy.get_objects()); diff = summary.get_diff(before, after); summary.print_(diff) — show objects created; agent identifies what objects were created during operation
  • Agent incremental leak detection — from pympler import tracker; tr = tracker.SummaryTracker(); process_batch_1(); tr.print_diff(); process_batch_2(); tr.print_diff() — track growth between snapshots; agent periodic memory check shows cumulative growth; each print_diff() shows objects created since last snapshot
  • Agent class tracking — from pympler.classtracker import ClassTracker; ct = ClassTracker(); ct.track_class(AgentContext); ct.create_snapshot('before'); run_agent(); ct.create_snapshot('after'); ct.stats.print_summary() — class-specific tracking; agent monitors how many AgentContext instances exist and their total memory
  • Agent memory budget assertion — from pympler import asizeof; payload = build_response(data); size = asizeof.asizeof(payload); assert size < 10 * 1024 * 1024, f'Response too large: {size / 1e6:.1f}MB' — size budget check; agent test verifies response objects stay within memory budget

Not For

  • Production monitoring — Pympler has significant overhead; for production use psutil or prometheus_client
  • CPU profiling — Pympler measures memory not CPU; for CPU use cProfile or pyinstrument
  • High-frequency measurements — asizeof traverses full object graph; expensive for hot paths

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No auth — local memory analysis tool.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Pympler is Apache 2.0 licensed. Free for all use.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • asizeof() includes all referenced objects recursively — asizeof.asizeof(large_dict) includes all values in the dict and their children; for a dict of 1000 large objects: asizeof returns total memory of all 1000 objects; agent code comparing: asizeof vs sys.getsizeof: sys.getsizeof(d) returns just dict overhead, asizeof returns everything
  • muppy.get_objects() is slow on large heaps — getting all objects traverses entire Python heap; on systems with 1M+ objects (ML models): takes seconds; agent debugging must run outside production; never call in request handlers or background jobs
  • SummaryTracker captures its own objects — tracker.SummaryTracker() stores snapshot of objects including itself; first print_diff() includes tracker's own objects; subsequent calls show only net new objects; ignore 'tracker' type entries in diff output
  • asizeof doesn't see C extension internals — numpy arrays, PyTorch tensors: asizeof sees Python wrapper but not underlying C memory; numpy array of 1GB: asizeof returns small Python object size; for numpy use arr.nbytes; for PyTorch use tensor.element_size() * tensor.nelement()
  • Web interface opens browser — from pympler.web import start_profiler; start_profiler() opens browser-based memory viewer on localhost:8080; agent code in automated testing must not call start_profiler(); use programmatic API (SummaryTracker, asizeof) for automation
  • Pympler is mature but less maintained — Pympler hasn't had major releases since 2021; for active development consider memray (Bloomberg, active development) for more modern memory profiling; Pympler's asizeof remains useful and stable for object size analysis

Alternatives

Full Evaluation Report

Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for Pympler.

AI-powered analysis · PDF + markdown · Delivered within 30 minutes

$99

Package Brief

Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.

Delivered within 10 minutes

$3

Score Monitoring

Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.

Continuous monitoring

$3/mo

Scores are editorial opinions as of 2026-03-06.

5229
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered