LeakCanary is a sophisticated memory leak detection library for Android and Java, developed by Square. In production, it integrates into Android applications to automatically monitor object allocations, trigger heap dumps upon detecting suspicious memory growth, and analyze these dumps to identify leaking objects. It provides detailed leak traces showing the reference path from GC roots to the leaking object, helping developers pinpoint the root cause. The project also includes Shark Dive, a powerful desktop application for interactive heap dump exploration using treemap, radial, and stack visualizations, and a CLI tool for batch analysis. The architecture is a multi-module monorepo with a clean separation of concerns. The core analysis engine (shark) is platform-independent, handling HPROF parsing, heap graph construction, dominator tree computation (Lengauer-Tarjan), and shortest path finding. Android-specific modules (leakcanary-android-*) provide lifecycle integration, UI, and notification handling. The desktop app (shark-dive-app) is built with Kotlin Compose UI and features an agent protocol for AI-assisted analysis. The codebase is primarily Kotlin, leveraging Okio for I/O and Gradle for building. The repository exhibits exceptionally high craftsmanship. It implements complex graph algorithms (dominator trees, multi-strength BFS reachability, squarified treemap layout) with clear, well-tested code. It solves hard engineering problems like sorting data larger than 2GB (PagedByteArrayTimSort) and building memory-efficient indexes. While actively maintained, the codebase shows some technical drift with deprecated APIs and TODOs, but the core algorithms and architecture are timeless and robust. It is a prime example of a well-engineered, domain-specific analysis tool.
GEF (GDB Enhanced Features) is a production-grade GDB plugin for exploit development, reverse engineering, and binary analysis. It is a single Python script (gef.py) that loads into GDB (>=10.0) and provides over 90 commands covering memory inspection, heap analysis, security mitigation checks (checksec), pattern generation, format string detection, and remote debugging. The architecture is monolithic but well-organized, with a clear separation of concerns via class hierarchies for architectures, memory regions, heap structures, and command registration. The test suite is extensive, using a Docker-based CI matrix that runs on multiple architectures (x86, ARM, AARCH64, etc.) and validates behaviour through RPyC-driven remote GDB sessions. While primarily an application, it also serves as a research tool for heap allocator internals and glibc version-specific behaviour, blending practical utility with deep system understanding.
Memlab is a comprehensive JavaScript memory leak detection and heap analysis framework developed by Meta. It provides a CLI, a programmatic API, and an MCP (Model Context Protocol) server for AI-assisted debugging. The system captures heap snapshots from Chromium (via Puppeteer), Node.js, Electron.js, and Hermes, then parses and analyzes them to identify memory leaks, optimization opportunities, and retention patterns. It includes specialized detectors for detached DOM elements, React component leaks, event listener accumulation, duplicate strings, and global variable bloat. The architecture is a monorepo with packages for core parsing and algorithms, E2E browser automation, heap analysis plugins, a public API, a CLI, an in-browser visualizer (MemLens), and an MCP server that exposes over 100 analysis tools. Key data flows involve warmup, browser interaction, snapshot capture, parsing, leak filtering, trace clustering (heuristic and ML-based), and report generation. External dependencies include Puppeteer, Chromium, and the MCP SDK.
Java Mission Control (JMC) is an open-source tool for monitoring, managing, and profiling Java applications. It provides a graphical user interface built on Eclipse RCP for connecting to Java applications via JMX, analyzing Java Flight Recorder (JFR) data, and performing heap analysis. The application features a modular OSGi plugin architecture with core libraries for shared functionality (unit handling, flight recorder parsing, JMX common) and application plugins for specific features (flight recorder UI, JMX console, browser, agent). Key capabilities include real-time MBean monitoring, flight recording control and analysis, heap dump analysis, and custom rule-based diagnostics.
Wirebrowser is an Electron desktop application that provides an integrated runtime instrumentation platform for web applications, built entirely on the Chrome DevTools Protocol (CDP). In production, it acts as a unified debugger, memory inspector, network interceptor, and automation runner for JavaScript running in Chromium-based browsers. The application launches a headless or headful Chrome instance via Puppeteer-core, attaches CDP debuggers to multiple pages, and presents a rich GUI (React, Ant Design, Monaco Editor, AG Grid) through an Electron window. The architecture follows a modular event-driven design: core back-end modules (Heap, Debugger, Network, Automation) are loaded by a ModuleManager and communicate with the front-end via custom DOM events and Electron IPC. The debugger module implements a sophisticated hook system that injects user-defined JavaScript callbacks on function entry/leave/return without monkeypatching, using CDP breakpoints and a state machine to serialize asynchronous events. The heap module supports both live object search (via injected QueryObjects) and offline snapshot analysis with object similarity matching (Jaccard/Dice/SimHash) for origin tracing. Key data flows include user-defined automation scripts (Node-side or browser-side) that interact with pages through the WB.Node and WB.Browser APIs, network requests that can be intercepted and modified in real-time, and memory snapshots that are queried for structural matches across multiple snapshots (BDHS). External dependencies are heavy: Puppeteer (bundled Chrome), AG-Grid (community), Monaco Editor, Ant Design, lowdb, and several CDP-specific features that lock the tool to Chromium. The project is primarily targeted at security researchers, reverse engineers, and advanced frontend developers who need introspection beyond standard DevTools.