Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
By Sam Rawlins Ruby 2.1 is coming out soon with an amazing new feature under ObjectSpace: #trace_object_allocations. We are now able to trace the file and line number (as well as method) where any Ruby object is allocated from. This is a very welcome feature, as object-level tracing has been very difficult in Ruby, especially since the memprof gem could not support Ruby past 1.8.x. This new Ruby 2.1 feature is really just exposing some raw (and vast) data, so it can be difficult to tease out meaningful information. Two gems are introduced in this talk to solve just that problem. The objspace-stats gem allows us to view and summarize new object allocations in meaningful ways. We'll look at how to filter, group, and sort new object allocations. The second gem is rack-objspace-stats. We'll see how this tool can intercept requests to a Rack stack, and measure new object allocations taking place during the request. (For those familiar, this works very similar to the rack-perftools_profiler gem.) We'll look at various examples of how this new Ruby 2.1 feature, and these tools can help an organization reduce unnecessary memory allocations, and speed up their code, especially mature Rack applications. Help us caption & translate this video! http://amara.org/v/FG2j/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In this talk, Sam Rawlins introduces a powerful new feature in Ruby 2.1 called `#trace_object_allocations`, which allows developers to trace object allocations down to the file and line number where they occur. This feature represents a significant advancement due to the previous limitations in memory profiling tools for Ruby, especially with earlier versions like 1.8.x. With Ruby 2.1, the new methods such as `trace_object_allocations`, `start`, `stop`, and `clear` enhance the ability to understand memory usage within applications. ### Key Points: - **Introduction to Ruby 2.1**: Sam Rawlins greets attendees and highlights the excitement surrounding Ruby 2.1 and its new profiling capabilities. - **Challenges of Memory Profiling**: Previously, tools for memory profiling were limited, making it hard to diagnose memory issues within applications. An anecdote from GitHub exemplifies the necessity for efficient profiling after they discovered high object counts at app startup. - **Tracing Object Allocations**: Developers can now trace object allocations using `trace_object_allocations` with examples demonstrating how to incorporate this feature in code blocks or through method calls. - **Importance of Reducing Allocations**: The talk emphasizes reducing the memory footprint to enhance garbage collection efficiency. GitHub's insights on high object counts at startup underscore the need for this feature. - **Using the `allocation_stats` Gem**: This gem simplifies the aggregation of allocation data, allowing users to view allocations by source file and class, offering better clarity on memory usage. - **Performance Optimization Techniques**: The presentation explores using frozen strings in Ruby 2.1 to minimize memory allocations, which can dramatically improve performance by reducing garbage collection overhead. - **Active Record and Rails Optimization**: Sam points out common sources of excessive allocations in Rails applications, particularly through Active Record and Active Support, suggesting refactoring methods for efficiency. - **Gems for Rack Applications**: The `rack-allocation-stats` gem can be employed in Rack applications to identify top allocation sites and optimize memory usage as requests are processed. - **Concluding Remarks**: The session wraps up with a call to action for developers to utilize the tools available in Ruby 2.1 and be proactive in optimizing their applications to reduce memory allocation overhead. Overall, Rawlins urges developers to take advantage of these new tools and features to improve application performance and efficiency in memory management, contributing to a more robust programming environment.
Suggest modifications
Cancel