nakayoshi_fork 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +1 -1
- data/Rakefile +0 -0
- data/lib/nakayoshi_fork.rb +20 -20
- data/lib/nakayoshi_fork/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae7c045fc5fc03c87c17f196fb1d8acd29257923
|
4
|
+
data.tar.gz: 1c8a712d346d107143b15700b719166793f8f8d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b72d9e1912591fca5e341884f19ec81fbb571b5eaf96e2892c80e8c06e3caedb842591d996d828a1e683f22ead1f0c17e38b1e748064fb5c559cbbb9cdf329c5
|
7
|
+
data.tar.gz: 3ae660567b7106413947aaba260c6ebcb49fa7fabb9f19b29716e96f5eddfb76cb817d6b3664f4980ed765c2a777d45e8a28ad9ff009024152c302b137d83030
|
data/.gitignore
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
data/Rakefile
CHANGED
File without changes
|
data/lib/nakayoshi_fork.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
1
|
require "nakayoshi_fork/version"
|
2
2
|
|
3
3
|
module NakayoshiFork
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
module Behavior
|
5
|
+
def fork(nakayoshi: true, cow_friendly: true, &b)
|
6
|
+
if nakayoshi && cow_friendly
|
7
|
+
h = {}
|
8
|
+
4.times{ # maximum 4 times
|
9
|
+
GC.stat(h)
|
10
|
+
live_slots = h[:heap_live_slots] || h[:heap_live_slot]
|
11
|
+
old_objects = h[:old_objects] || h[:old_object]
|
12
|
+
remwb_unprotects = h[:remembered_wb_unprotected_objects] || h[:remembered_shady_object]
|
13
|
+
young_objects = live_slots - old_objects - remwb_unprotects
|
13
14
|
|
14
|
-
|
15
|
+
break if young_objects < live_slots / 10
|
15
16
|
|
16
|
-
|
17
|
+
disabled = GC.enable
|
18
|
+
GC.start(full_mark: false)
|
19
|
+
GC.disable if disabled
|
20
|
+
}
|
21
|
+
end
|
17
22
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
22
|
-
end
|
23
|
-
|
24
|
-
super(&b)
|
25
|
-
end if GC.method(:start).arity != 0
|
23
|
+
super(&b)
|
24
|
+
end if GC.method(:start).arity != 0
|
25
|
+
end
|
26
26
|
end
|
27
27
|
|
28
28
|
class Object
|
29
|
-
prepend NakayoshiFork
|
29
|
+
prepend NakayoshiFork::Behavior
|
30
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nakayoshi_fork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi Sasada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.6.11
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: nakayoshi_fork gem solves CoW friendly problem on MRI 2.2 and later.
|