oj 3.6.8 → 3.6.9

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: aba240d544c37d3f3c5e2a6c7fe51b29507ba354b76ede963bd868e620df4ece
4
- data.tar.gz: 832dd821fa37c9ff2fd7b993c2529537a86b54ca2eded2a72f39ac8c6980bfd1
3
+ metadata.gz: 74bbbdb4c9cecc3d5008e135e276f134b3ccaa53d56d37e01f9039c80962abd8
4
+ data.tar.gz: 591d6d922cb44220f963d0432d246ab839001d8599bb9bc3ad562248df2c3b2a
5
5
  SHA512:
6
- metadata.gz: e485a0613aa0306d2a5239fbccc510cfc67456760f6e01ad65c7075f2c42f0a2a6fd796dca4b35e8002a2ec7ee950801ae0ce2478ebae0e3e7715d8021eef4dc
7
- data.tar.gz: fa9a0f9e185ae31e783515012f1b9e5c09bc4341e1cfe5f20f8341639d30fef5ae2d748b260fe12e3753eaf4d3e7260c5ee67d81a5706b2b950256065a5530a8
6
+ metadata.gz: 5cc9a42e0e64f59b4120cb39986d9b90f1b2f55585cc5c5df79e3be12b6d177407d58b3380006349b3dd6d42aece669da62d8c147c833567465377501ce11eca
7
+ data.tar.gz: 7b822b5752305070cd1fa9371c2bd5808ff3e127413482ef6a9a7af062c555cd79884a9a3ff0e3f5b3dc3675db84197b28a20259eb03969dbc930cb3f2d975c9
@@ -691,9 +691,12 @@ oj_dump_str(VALUE obj, int depth, Out out, bool as_ok) {
691
691
 
692
692
  void
693
693
  oj_dump_sym(VALUE obj, int depth, Out out, bool as_ok) {
694
- const char *sym = rb_id2name(SYM2ID(obj));
694
+ // This causes a memory leak in 2.5.1. Maybe in other versions as well.
695
+ //const char *sym = rb_id2name(SYM2ID(obj));
695
696
 
696
- oj_dump_cstr(sym, strlen(sym), 0, 0, out);
697
+ volatile VALUE s = rb_sym_to_s(obj);
698
+
699
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&s), RSTRING_LEN(s), 0, 0, out);
697
700
  }
698
701
 
699
702
  static void
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.6.8'
4
+ VERSION = '3.6.9'
5
5
  end
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $: << '.'
4
+ $: << '../lib'
5
+ $: << '../ext'
6
+
7
+ require 'objspace'
8
+ require 'oj'
9
+ require 'json'
10
+ require 'get_process_mem'
11
+
12
+ def record_allocation
13
+ GC.start
14
+ GC.start
15
+
16
+ mem = GetProcessMem.new
17
+ puts "Before - Process Memory: #{mem.mb} mb"
18
+ puts "Before - Objects count: #{ObjectSpace.each_object.count}"
19
+ puts "Before - Symbols count: #{Symbol.all_symbols.size}"
20
+
21
+ yield
22
+
23
+ GC.start
24
+ GC.start
25
+ GC.start
26
+
27
+ puts "After - Process Memory: #{mem.mb} mb"
28
+ puts "After - Objects count: #{ObjectSpace.each_object.count}"
29
+ puts "After - Symbols count: #{Symbol.all_symbols.size}"
30
+ end
31
+
32
+ record_allocation do
33
+ data = 1_000_000.times.map { |i| "string_number_#{i}".to_sym } # array of symbols
34
+ Oj.dump(data, mode: :strict)
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.8
4
+ version: 3.6.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-08 00:00:00.000000000 Z
11
+ date: 2018-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -198,6 +198,7 @@ files:
198
198
  - test/json_gem/json_parser_test.rb
199
199
  - test/json_gem/json_string_matching_test.rb
200
200
  - test/json_gem/test_helper.rb
201
+ - test/mem.rb
201
202
  - test/perf.rb
202
203
  - test/perf_compat.rb
203
204
  - test/perf_fast.rb
@@ -315,6 +316,7 @@ test_files:
315
316
  - test/test_scp.rb
316
317
  - test/perf_wab.rb
317
318
  - test/test_saj.rb
319
+ - test/mem.rb
318
320
  - test/perf_compat.rb
319
321
  - test/helper.rb
320
322
  - test/isolated/test_mimic_alone.rb