Memory::Profiler
Efficient memory allocation tracking focused on retained objects only. Automatically tracks allocations and cleans up when objects are freed, giving you precise data on memory leaks.
Features
- Retained Objects Only: Uses
RUBY_INTERNAL_EVENT_NEWOBJandRUBY_INTERNAL_EVENT_FREEOBJto automatically track only objects that survive GC. - O(1) Live Counts: Maintains per-class counters updated on alloc/free - no heap enumeration needed!
- Tree-Based Analysis: Deduplicates common call paths using an efficient tree structure.
Usage
Please browse the source code index or refer to the guides below.
Getting Started
This guide explains how to use memory-profiler to automatically detect and diagnose memory leaks in Ruby applications.
Rack Integration
This guide explains how to integrate memory-profiler into Rack applications for automatic memory leak detection.
Releases
Please browse the releases for more details.
v1.1.5
- Use queue for
newobjtoo to avoid invoking user code during object allocation.
v1.1.2
- Fix handling of GC compaction (I hope).
v0.1.0
- Initial implementation.
Contributing
We welcome contributions to this project.
- Fork it.
- Create your feature branch (
git checkout -b my-new-feature). - Commit your changes (
git commit -am 'Add some feature'). - Push to the branch (
git push origin my-new-feature). - Create new Pull Request.
Developer Certificate of Origin
In order to protect users of this project, we require all contributors to comply with the Developer Certificate of Origin. This ensures that all contributions are properly licensed and attributed.
Community Guidelines
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.