sqreen 1.15.7-java → 1.15.8.beta1-java
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/lib/sqreen/js/mini_racer_adapter.rb +40 -2
- data/lib/sqreen/log.rb +1 -0
- data/lib/sqreen/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66bf85c79c2d173c45c518aafb126e5726c2374b7bfa8f6ae6213fd8f6550540
|
4
|
+
data.tar.gz: 321e2231f412736d72db851b5b942a8a7ecbddae9a7d6b9764ab138945522726
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b11fc87bdd5af37267ebcdcf2097c0472bcf94157bfb5c70fa83368498f88e1ffcd26f88e66a998023261b171bcc91ba500dad814148620f5e1a593afda5a37
|
7
|
+
data.tar.gz: 1bc18bee61f9d3a9ec916ef45a89b4f1bdafbd7deb5adcf54d847a007a4137c738d2743ead289aac3190499497e15502c3cffa19ec52a707cdcd92dedd699ce3
|
@@ -59,8 +59,25 @@ module Sqreen
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
def give_back_context(
|
63
|
-
|
62
|
+
def give_back_context(context)
|
63
|
+
context.possibly_gc
|
64
|
+
|
65
|
+
if context.gc_load > 30
|
66
|
+
if context.gc_threshold_in_bytes == DEFAULT_GC_THRESHOLD
|
67
|
+
context.gc_threshold_in_bytes *= 2
|
68
|
+
Sqreen.log.warn('Context %s had too many close garbage collections; ' \
|
69
|
+
'doubling the threshold to %d bytes',
|
70
|
+
context, context.gc_threshold_in_bytes)
|
71
|
+
context.gc_load = 0
|
72
|
+
else
|
73
|
+
Sqreen.log.warn('Context %s had too many close garbage ' \
|
74
|
+
'collections; discarding it', context)
|
75
|
+
context.dispose
|
76
|
+
return
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
@mutex.synchronize { @contexts.push(context); }
|
64
81
|
end
|
65
82
|
end
|
66
83
|
|
@@ -194,10 +211,15 @@ module Sqreen
|
|
194
211
|
private
|
195
212
|
|
196
213
|
class << self
|
214
|
+
DEFAULT_GC_THRESHOLD = 15000000 # 15 MB
|
215
|
+
|
197
216
|
def define_sqreen_context(modoole)
|
198
217
|
# Context specialized for Sqreen usage
|
199
218
|
Sqreen::Js.const_set 'SqreenContext', Class.new(modoole.const_get('Context'))
|
200
219
|
SqreenContext.class_eval do
|
220
|
+
attr_accessor :gc_threshold_in_bytes
|
221
|
+
attr_accessor :gc_load
|
222
|
+
|
201
223
|
def has_code?(code_id)
|
202
224
|
return false unless @code_ids
|
203
225
|
@code_ids.include?(code_id)
|
@@ -233,6 +255,22 @@ module Sqreen
|
|
233
255
|
end
|
234
256
|
end
|
235
257
|
|
258
|
+
def possibly_gc
|
259
|
+
Sqreen.log.warn("Heap usage: #{heap_stats[:total_heap_size]} for #{object_id}")
|
260
|
+
|
261
|
+
@gc_threshold_in_bytes = DEFAULT_GC_THRESHOLD
|
262
|
+
@gc_load ||= 0
|
263
|
+
|
264
|
+
# garbage collections max 1 in every 4 calls (avg)
|
265
|
+
if heap_stats[:total_heap_size] > @gc_threshold_in_bytes
|
266
|
+
Sqreen.log.warn("Doing low memory notification for context")
|
267
|
+
low_memory_notification
|
268
|
+
@gc_load += 4
|
269
|
+
else
|
270
|
+
@gc_load = [0, @gc_load - 1].max
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
236
274
|
private
|
237
275
|
|
238
276
|
def transf_global_funcs(code_id)
|
data/lib/sqreen/log.rb
CHANGED
data/lib/sqreen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqreen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.15.
|
4
|
+
version: 1.15.8.beta1
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Sqreen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,9 +148,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - "
|
151
|
+
- - ">"
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
153
|
+
version: 1.3.1
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
156
|
rubygems_version: 2.7.7
|