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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab0f7f327746411e048e85c39d5a85eb0e5160de4561d9dd996b689313db356e
4
- data.tar.gz: a6b48b211b1694a109e57e394ceec8c678b31585a3313211d028ab0798467b2d
3
+ metadata.gz: 66bf85c79c2d173c45c518aafb126e5726c2374b7bfa8f6ae6213fd8f6550540
4
+ data.tar.gz: 321e2231f412736d72db851b5b942a8a7ecbddae9a7d6b9764ab138945522726
5
5
  SHA512:
6
- metadata.gz: 3e951226c019ee021a9203609971bef97b9bc738f43a624c41e4eedae17803009f3d6232f336422522b6f9b0453b631423674327c5f3ebb78db1e7a7f0506905
7
- data.tar.gz: 19297ce483987c4c714a76b76409ca7139ebda5ec01f4da7ca79ce5d80a6faa1b37d732df9548037c00319ac1b82e40f906c384e29dfb9a869c088fc0010cd89
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(isolate)
63
- @mutex.synchronize { @contexts.push(isolate); }
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)
@@ -2,6 +2,7 @@
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
3
 
4
4
  require 'logger'
5
+ require 'singleton'
5
6
 
6
7
  require 'sqreen/performance_notifications/log'
7
8
  require 'sqreen/performance_notifications/log_performance'
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2015 Sqreen. All Rights Reserved.
2
2
  # Please refer to our terms for more information: https://www.sqreen.io/terms.html
3
3
  module Sqreen
4
- VERSION = '1.15.7'.freeze
4
+ VERSION = '1.15.8.beta1'.freeze
5
5
  end
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.7
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-29 00:00:00.000000000 Z
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: '0'
153
+ version: 1.3.1
154
154
  requirements: []
155
155
  rubyforge_project:
156
156
  rubygems_version: 2.7.7