nakayoshi_fork 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nakayoshi_fork.rb +7 -1
- data/lib/nakayoshi_fork/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47978bf9380f41c2546466d79bf4ba1fededee66
|
4
|
+
data.tar.gz: 692357d4bfecdb1920048ff7e122394ef8b43cef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28e162c46373b6ee779102b05e98e9bca5b4a517b496905817925fed400a0a89cafe6f3c2f8b071a2db88c86179d85603436bc59eb938a780f3b73cad60776dd
|
7
|
+
data.tar.gz: 2cebec608dd8d5d5c76b25a69d14e2b013a78924545ea3b2e85da86f4c07817c6f1abac699e621695f8b61cb4db0de0278df2dffbb7b6974d7f1371cd89d3604
|
data/lib/nakayoshi_fork.rb
CHANGED
@@ -4,14 +4,20 @@ module NakayoshiFork
|
|
4
4
|
def fork(nakayoshi: true, cow_friendly: true, &b)
|
5
5
|
if nakayoshi && cow_friendly
|
6
6
|
h = {}
|
7
|
-
|
7
|
+
4.times{ # maximum 4 times
|
8
8
|
GC.stat(h)
|
9
9
|
live_slots = h[:heap_live_slots] || h[:heap_live_slot]
|
10
10
|
old_objects = h[:old_objects] || h[:old_object]
|
11
11
|
remwb_unprotects = h[:remembered_wb_unprotected_objects] || h[:remembered_shady_object]
|
12
12
|
young_objects = live_slots - old_objects - remwb_unprotects
|
13
|
+
|
14
|
+
# p [[live_slots, old_objects, remwb_unprotects], [young_objects]]
|
15
|
+
|
13
16
|
break if young_objects < live_slots / 10
|
17
|
+
|
18
|
+
disabled = GC.enable
|
14
19
|
GC.start(full_mark: false)
|
20
|
+
GC.disable if disabled
|
15
21
|
}
|
16
22
|
end
|
17
23
|
|