README.md in memprof2-0.1.1 vs README.md in memprof2-0.1.2
- old
+ new
@@ -66,13 +66,23 @@
40 file.rb:2:String
```
*Note*: Use `Memprof2.report!` to clear out tracking data after printing out results.
+Use `trace` and `ignore` options to restrict files to report. You can write patterns by regular expressions:
+
+```
+Memprof2.start
+10.times{ $last_str = "abc" }
+GC.start
+Memprof2.report!(trace: /file\.rb/, ignore: /ignore_me/, out: "/path/to/file")
+Memprof2.stop
+```
+
## Memprof2.run
-Simple wrapper for `Memprof2.start/stop` that will start/stop memprof around a given block of ruby code.
+A shorthand for `Memprof2.start/stop` that will start/stop memprof around a given block of ruby code.
```ruby
Memprof2.run do
100.times{ "abc" }
100.times{ 1.23 + 1 }
@@ -88,9 +98,23 @@
4000 file.rb:3:Float
4000 file.rb:4:Module
```
*Note*: You can call GC.start at the end of the block to print out only objects that are 'leaking' (i.e. objects that still have inbound references).
+
+## Memprof2.run_with_report
+
+A shorthand for `Memprof2.start/report/stop`.
+
+Following codes work exactly same with the above example.
+
+```ruby
+Memprof2.run_with_report(out: "/path/to/file") do
+ 100.times{ "abc" }
+ 100.times{ 1.23 + 1 }
+ 100.times{ Module.new }
+end
+```
## ChangeLog
See [CHANGELOG.md](CHANGELOG.md) for details.