free 0.2.5-i386-mingw32 → 0.2.6-i386-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,10 +8,17 @@ _force immediate garbage collection of Ruby objects_
8
8
  free provides the `Object#free` method enabling a user to garbage
9
9
  collect an object on demand and free all its internal structures.
10
10
 
11
- * Install the [gem](https://rubygems.org/gems/free)
11
+ * Install the [gem](https://rubygems.org/gems/free): `gem install free`
12
12
  * Read the [documentation](http://rdoc.info/github/banister/free/master/file/README.md)
13
13
  * See the [source code](http://github.com/banister/free)
14
14
 
15
+ `free` also has `rubygems-test` support; to participate, first install
16
+ free, then:
17
+
18
+ 1. Install rubygems-test: `gem install rubygems-test`
19
+ 2. Run the test: `gem test free`
20
+ 3. Finally choose 'Yes' to upload the results.
21
+
15
22
  Example: Freeing a String
16
23
  -------------------------
17
24
 
@@ -57,7 +64,22 @@ Features and limitations
57
64
  * Beta software, beware.
58
65
  * Supports MRI and YARV only.
59
66
  * Not complete protection from freeing silly things, e.g core classes. Be sensible :)
60
- * Can be dangerous - `free` will force garbage collection on an object even if references to it still exist. Trying to access an already freed object may result in unexpected behaviour or segfaults.
67
+ * Can be dangerous - `free` will force garbage collection on an object
68
+ * even if references to it still exist. Trying to access an already
69
+ * freed object may result in unexpected behaviour or segfaults.
70
+
71
+ ### Caveats
72
+
73
+ Benchmarks have shown that `free` can significantly improve performance, but only
74
+ when the objects you free are very large (approximately > 50K
75
+ in size).
76
+
77
+ It is not recommended you free small or medium-sized objects as you will
78
+ actually negatively impact performance - as the `free` process itself
79
+ incurs some overhead.
80
+
81
+ In general you should benchmark your application with and without
82
+ `free` before you decide to use it.
61
83
 
62
84
  Contact
63
85
  -------
data/Rakefile CHANGED
@@ -21,6 +21,7 @@ def apply_spec_defaults(s)
21
21
  s.email = 'jrmair@gmail.com'
22
22
  s.description = s.summary
23
23
  s.require_path = 'lib'
24
+ s.add_development_dependency("bacon",">=1.1.0")
24
25
  s.homepage = "http://banisterfiend.wordpress.com"
25
26
  s.has_rdoc = 'yard'
26
27
  s.files = Dir["ext/**/extconf.rb", "ext/**/*.h", "ext/**/*.c", "lib/**/*.rb",
data/lib/free/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Free
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -0,0 +1,7 @@
1
+ require 'benchmark'
2
+ require '../lib/free'
3
+
4
+ TIMES = 900_00
5
+ REPEATS = 50_000
6
+
7
+ STR = "x" * REPEATS
@@ -0,0 +1,4 @@
1
+ require './bench_base'
2
+
3
+ puts "free #{Benchmark.measure { TIMES.times { j = STR.dup; j << rand(100).to_s ; j.free } }}"
4
+
@@ -0,0 +1,4 @@
1
+ require './bench_base'
2
+
3
+ puts "non free #{Benchmark.measure { TIMES.times { j = STR.dup; j << rand(100).to_s } }}"
4
+
data/test/test.rb CHANGED
@@ -17,7 +17,7 @@ describe Free do
17
17
  c = v
18
18
 
19
19
  # grab the object id since referring to object directly (through
20
- # c) will likely result in segfault, which can't be rescued.
20
+ # v) will likely result in segfault, which can't be rescued.
21
21
  id = v.object_id
22
22
 
23
23
  ObjectSpace._id2ref(id).should == v
@@ -27,7 +27,7 @@ describe Free do
27
27
 
28
28
  # Two things may happen if it is properly freed:
29
29
  # 1. The _id2ref resolves to another object (the free slot is
30
- # replace by a new object)
30
+ # replaced by a new object)
31
31
  # 2. Calling _id2ref raises an exception, typically a RangeError
32
32
  (ObjectSpace._id2ref(id) != v || lambda { ObjectSpace._id2ref(id) } rescue true).should == true
33
33
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: free
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 2
9
- - 5
10
- version: 0.2.5
8
+ - 6
9
+ version: 0.2.6
11
10
  platform: i386-mingw32
12
11
  authors:
13
12
  - John Mair (banisterfiend)
@@ -15,10 +14,24 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2011-01-04 00:00:00 +13:00
17
+ date: 2011-01-27 00:00:00 +13:00
19
18
  default_executable:
20
- dependencies: []
21
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: bacon
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 1
31
+ - 0
32
+ version: 1.1.0
33
+ type: :development
34
+ version_requirements: *id001
22
35
  description: Force immediate garbage collection of an object.
23
36
  email: jrmair@gmail.com
24
37
  executables: []
@@ -54,6 +67,9 @@ files:
54
67
  - ext/free/free.c
55
68
  - lib/free/version.rb
56
69
  - lib/free.rb
70
+ - test/bench_base.rb
71
+ - test/bench_free.rb
72
+ - test/bench_non_free.rb
57
73
  - test/test.rb
58
74
  - HISTORY
59
75
  - README.md
@@ -74,7 +90,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
90
  requirements:
75
91
  - - ">="
76
92
  - !ruby/object:Gem::Version
77
- hash: 3
78
93
  segments:
79
94
  - 0
80
95
  version: "0"
@@ -83,7 +98,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
98
  requirements:
84
99
  - - ">="
85
100
  - !ruby/object:Gem::Version
86
- hash: 3
87
101
  segments:
88
102
  - 0
89
103
  version: "0"