# tencent/matrix

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/tencent-matrix).**

12,020 stars · 1,925 forks · Java · NOASSERTION

## Links

- GitHub: https://github.com/Tencent/matrix
- awesome-repositories: https://awesome-repositories.com/repository/tencent-matrix.md

## Topics

`android` `apm-client` `wechat`

## Description

Matrix is a suite of mobile application performance management and analysis tools. It provides a plugin-based monitoring system for capturing crashes, lags, and memory leaks, alongside a static binary auditor for reducing installation package size and a bytecode instrumentation tool for performance tracking.

The project distinguishes itself through native memory debugging and a SQLite query linter that identifies inefficient database patterns. It employs native interception techniques to detect memory leaks and heap corruption without requiring source code recompilation, and uses a custom runloop monitor to identify main-thread blocks and application hangs.

The broader capability surface covers binary analysis for asset auditing and bloat reduction, UI performance profiling for frame rate and startup latency, and detailed memory analysis including heap dump processing. It also includes observability for disk IO bottlenecks and power consumption monitoring to identify energy-inefficient code paths.

The tool can be run as an executable JAR for integration into CI/CD pipelines.

## Tags

### Mobile Development

- [Mobile Performance Monitoring](https://awesome-repositories.com/f/mobile-development/mobile-performance-monitoring.md) — Provides a comprehensive framework for tracking crashes, lags, and memory leaks in real time for mobile apps.
- [ANR Detection](https://awesome-repositories.com/f/mobile-development/anr-detection.md) — Identifies Application Not Responding events and generates stable trace files to pinpoint the cause. ([source](https://github.com/tencent/matrix#readme))
- [APK Asset Auditing](https://awesome-repositories.com/f/mobile-development/apk-asset-auditing.md) — Identifies redundant resources and unused assets within APKs using custom checking rules. ([source](https://github.com/tencent/matrix#readme))
- [Battery Status Monitors](https://awesome-repositories.com/f/mobile-development/battery-status-monitors.md) — Monitors mobile device power usage through a flexible API to identify battery-draining behavior. ([source](https://github.com/tencent/matrix#readme))

### System Administration & Monitoring

- [Application Performance Monitoring](https://awesome-repositories.com/f/system-administration-monitoring/application-performance-monitoring/application-performance-monitoring.md) — Implements a plugin-based monitoring system for tracking crashes, lags, and memory leaks in mobile applications. ([source](https://github.com/Tencent/matrix/wiki/Matrix-for-iOS-macOS-Data-Format-Description))
- [Application Hang Detection](https://awesome-repositories.com/f/system-administration-monitoring/application-observability/application-hang-detection.md) — Monitors the Runloop status to identify stuck applications and capture time-consuming thread stacks. ([source](https://github.com/tencent/matrix#readme))
- [Execution Time Profilers](https://awesome-repositories.com/f/system-administration-monitoring/execution-time-profilers.md) — Measures function execution times using bytecode modification to identify slow functions and interface blocks. ([source](https://github.com/tencent/matrix#readme))
- [Execution Tracing](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/execution-tracing-analysis/execution-tracing.md) — Records the sequence of function calls and execution times for long-running methods during startup. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [Slow Function Identification](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/slow-function-identification.md) — Captures execution time and call stacks for long-running methods during activity transitions or ANRs. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [Disk IO Observability](https://awesome-repositories.com/f/system-administration-monitoring/disk-io-observability.md) — Detects inefficient system calls and unclosed file descriptors that cause application bottlenecks.
- [Energy Consumption Analyzers](https://awesome-repositories.com/f/system-administration-monitoring/energy-management/energy-consumption-analyzers.md) — Captures stack traces related to high power consumption to identify energy-inefficient code paths. ([source](https://github.com/Tencent/matrix/wiki/Matrix-for-iOS-macOS-Data-Format-Description))
- [Observability Data Aggregators](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/cross-account-observability-aggregators/observability-data-filters/observability-data-aggregators.md) — Captures probe data and routes it to custom listeners for external reporting and analysis. ([source](https://github.com/Tencent/Matrix/wiki/Matrix-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))
- [IO Bottleneck Detection](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/observability-platforms/metric-performance-monitors/device-performance-monitors/io-bottleneck-detection.md) — Detects disk and network IO issues using system-level hooks to identify bottlenecks on real devices. ([source](https://github.com/Tencent/Matrix/wiki/Matrix-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98))
- [Object Allocation Profilers](https://awesome-repositories.com/f/system-administration-monitoring/object-allocation-profilers.md) — Records every object creation and its associated callstack to diagnose the cause of OOM errors. ([source](https://github.com/tencent/matrix#readme))
- [Frame Rate Monitors](https://awesome-repositories.com/f/system-administration-monitoring/performance-monitoring-tools/performance-resource-management/frame-rate-monitors.md) — Calculates frames per second and quantifies frame drops to identify UI lag and stuttering. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [Disk I/O Performance Analysis](https://awesome-repositories.com/f/system-administration-monitoring/performance-monitoring-tools/performance-tuning/disk-i-o-performance-analysis.md) — Monitors file system operations to detect main-thread blocking and unclosed file handles. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [Power Consumption Monitoring](https://awesome-repositories.com/f/system-administration-monitoring/power-consumption-monitoring.md) — Deno Monitoring & Observability records energy-consuming call stacks in JSON format to identify specific code paths causing battery drain. ([source](https://github.com/Tencent/matrix/wiki/Matrix-for-iOS-macOS-%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E))

### Part of an Awesome List

- [Bytecode and Instrumentation](https://awesome-repositories.com/f/awesome-lists/devtools/bytecode-and-instrumentation.md) — Implements bytecode modification during compilation to inject performance tracking and call stack recording.
- [Crash Monitoring](https://awesome-repositories.com/f/awesome-lists/devtools/crash-monitoring.md) — Provides a system for capturing and reporting detailed application crash logs in JSON format. ([source](https://github.com/Tencent/matrix/wiki/Matrix-for-iOS-macOS-%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E))
- [Structured Log Analysis](https://awesome-repositories.com/f/awesome-lists/devtools/crash-and-monitoring/structured-log-analysis.md) — Produces structured data from crashes and lags, including energy-consuming stacks for bottleneck analysis. ([source](https://github.com/Tencent/matrix/wiki/Matrix-for-iOS-macOS-Data-Format-Description))

### Data & Databases

- [Application Lag Detection](https://awesome-repositories.com/f/data-databases/primary-replica-replication/replication-lag-monitors/application-lag-detection.md) — Tracks hanging or lagging execution patterns and provides detailed diagnostic logs with report IDs. ([source](https://github.com/Tencent/matrix/wiki/Matrix-for-iOS-macOS-%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E))
- [Query Auditing Tools](https://awesome-repositories.com/f/data-databases/database-management-systems/database-engines/embedded-databases/sqlite-databases/query-auditing-tools.md) — Scans database operations for inefficiencies such as full table scans and missing indices. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [Database Query Optimizations](https://awesome-repositories.com/f/data-databases/database-management-systems/database-systems-management/performance-optimization-tools/database-query-optimizations.md) — Identifies inefficient database queries and provides optimization advice to improve performance. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [Query Optimizers](https://awesome-repositories.com/f/data-databases/query-optimizers.md) — Detects full table scans and missing prepared statements in database queries to improve retrieval speed. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [SQL Query Optimizations](https://awesome-repositories.com/f/data-databases/sql-query-optimizations.md) — Inspects database operations to detect full table scans and inefficient SQL patterns. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [SQLite Query Linters](https://awesome-repositories.com/f/data-databases/sqlite-query-linters.md) — Scans database statements for full table scans and missing indexes to optimize retrieval speed.

### Development Tools & Productivity

- [Package Composition Analysis](https://awesome-repositories.com/f/development-tools-productivity/dependency-managers/package-composition-analysis.md) — Inspects oversized files and inefficient image formats within the application package to reduce the footprint. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android-ApkChecker))
- [Native Stack Unwinders](https://awesome-repositories.com/f/development-tools-productivity/dynamic-variable-evaluators/stack-frame-inspectors/native-stack-unwinders.md) — Generates native call stacks using simplified unwind tables derived from DWARF and ARM debug data.
- [Startup Timers](https://awesome-repositories.com/f/development-tools-productivity/application-startup-configurations/startup-runners/startup-timers.md) — Measures and tracks startup latency across different stages to identify boot performance bottlenecks. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))

### Operating Systems & Systems Programming

- [Binary Bloat Analysis](https://awesome-repositories.com/f/operating-systems-systems-programming/binary-analysis-capabilities/binary-bloat-analysis.md) — Inspects APKs for unused resources and redundant classes to optimize binary size. ([source](https://github.com/tencent/matrix#readme))
- [Mobile Binary Analysis](https://awesome-repositories.com/f/operating-systems-systems-programming/binary-analysis-capabilities/decompilers/mobile-binary-analysis.md) — Provides static analysis to identify unused assets and oversized files to reduce the installation package size.
- [Asset](https://awesome-repositories.com/f/operating-systems-systems-programming/hardware-interfacing-drivers/hardware-drivers/usage-auditing/asset.md) — Detects unused assets and verifies resource obfuscation to eliminate waste and reduce package size. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android-ApkChecker))
- [Heap Corruption Detection](https://awesome-repositories.com/f/operating-systems-systems-programming/heap-analyzers/heap-corruption-detection.md) — Identifies heap memory access overlaps, use-after-free, and double-free issues using memory sanitizers. ([source](https://github.com/tencent/matrix#readme))
- [Memory Allocation Tracers](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/memory-management/allocation-strategies/dynamic-memory-allocation/memory-allocation-tracers.md) — Tracks memory allocation patterns and stack calls during high-memory events to locate leaks. ([source](https://github.com/Tencent/matrix/wiki/Matrix-for-iOS-macOS-%E6%95%B0%E6%8D%AE%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E))
- [Native Application Debugging](https://awesome-repositories.com/f/operating-systems-systems-programming/native-application-debugging.md) — Identifies memory leaks, use-after-free errors, and double-frees in native libraries without recompilation.
- [Native Hooking Frameworks](https://awesome-repositories.com/f/operating-systems-systems-programming/native-hooking-frameworks.md) — Intercepts system calls and native library functions to monitor IO performance and detect memory leaks.
- [PLT Hooking](https://awesome-repositories.com/f/operating-systems-systems-programming/native-hooking-frameworks/plt-hooking.md) — Patches the procedure linkage table to intercept system calls and monitor binaries without recompilation.
- [Native Memory Debuggers](https://awesome-repositories.com/f/operating-systems-systems-programming/native-memory-debuggers.md) — Identifies memory leaks and heap corruption in native libraries without requiring source code recompilation.

### Programming Languages & Runtimes

- [Binary Size Optimizations](https://awesome-repositories.com/f/programming-languages-runtimes/binary-size-optimizations.md) — Finds binary optimization opportunities by checking for uncompressed files and missing image alpha channels. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android-ApkChecker))
- [Mobile App Binary Size Optimization](https://awesome-repositories.com/f/programming-languages-runtimes/binary-size-optimizations/mobile-app-binary-size-optimization.md) — Analyzes application packages to find unused assets and redundant resources to reduce installation size.
- [Runtime Bytecode Instrumentation](https://awesome-repositories.com/f/programming-languages-runtimes/compiler-interpreter-internals/compiler-infrastructure/intermediate-representations/bytecode/runtime-bytecode-instrumentation.md) — Modifies application code during compilation to inject performance tracking and call stack recording.

### Software Engineering & Architecture

- [Plugin-Based Architectures](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/plugin-module-systems/modular-plugin-architectures/plugin-based-architectures.md) — Provides a modular plugin interface to collect telemetry and route performance data to custom backends.
- [Telemetry Plugins](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/plugin-module-systems/modular-plugin-architectures/plugin-based-architectures/telemetry-plugins.md) — Uses a modular interface specifically to collect performance data from various sources.
- [Activity Leak Analysis](https://awesome-repositories.com/f/software-engineering-architecture/memory-usage-analysis/memory-leak-prevention/callback-leak-preventers/activity-leak-analysis.md) — Identifies leaking activities and provides cropped heap profiles to pinpoint the source of leaks. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [UI Blockage Detection](https://awesome-repositories.com/f/software-engineering-architecture/request-validation/validation-chains/wakeup-chain-mappers/scheduling-blockage-visualizers/ui-blockage-detection.md) — Identifies slow functions blocking the UI by recording execution costs and call stacks. ([source](https://github.com/tencent/matrix#readme))

### Testing & Quality Assurance

- [Application Performance Profiling](https://awesome-repositories.com/f/testing-quality-assurance/application-performance-profiling.md) — Measures frame rates, startup times, and main thread blocking to eliminate interface stuttering.
- [Memory Leak Detection](https://awesome-repositories.com/f/testing-quality-assurance/debugging-diagnostics/memory-leak-detection.md) — Tracks memory allocation and call stacks during out-of-memory events to find sources of exhaustion. ([source](https://github.com/Tencent/matrix/wiki/Matrix-for-iOS-macOS-Data-Format-Description))
- [Native](https://awesome-repositories.com/f/testing-quality-assurance/debugging-diagnostics/memory-leak-detection/native.md) — Identifies memory leaks in native libraries using hooking techniques without requiring code recompilation. ([source](https://github.com/Tencent/matrix/wiki/Matrix-Android--data-format))
- [Performance Profilers](https://awesome-repositories.com/f/testing-quality-assurance/performance-profilers.md) — Tracks frame rates, startup speed, and main-thread blocking to resolve interface stuttering.
- [Runloop Hang Detection](https://awesome-repositories.com/f/testing-quality-assurance/runloop-hang-detection.md) — Monitors the application runloop status to identify main thread blocks and capture time-consuming execution stacks.
- [Thread Leak Detection](https://awesome-repositories.com/f/testing-quality-assurance/debugging-diagnostics/memory-leak-detection/thread-leak-detection.md) — Identifies leaks in Java and native threads and reduces virtual memory overhead by trimming stack sizes. ([source](https://github.com/tencent/matrix#readme))
