oj 3.6.8 → 3.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/oj/dump.c +5 -2
- data/lib/oj/version.rb +1 -1
- data/test/mem.rb +35 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74bbbdb4c9cecc3d5008e135e276f134b3ccaa53d56d37e01f9039c80962abd8
|
4
|
+
data.tar.gz: 591d6d922cb44220f963d0432d246ab839001d8599bb9bc3ad562248df2c3b2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cc9a42e0e64f59b4120cb39986d9b90f1b2f55585cc5c5df79e3be12b6d177407d58b3380006349b3dd6d42aece669da62d8c147c833567465377501ce11eca
|
7
|
+
data.tar.gz: 7b822b5752305070cd1fa9371c2bd5808ff3e127413482ef6a9a7af062c555cd79884a9a3ff0e3f5b3dc3675db84197b28a20259eb03969dbc930cb3f2d975c9
|
data/ext/oj/dump.c
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
data/lib/oj/version.rb
CHANGED
data/test/mem.rb
ADDED
@@ -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.
|
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-
|
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
|