oj 2.12.3 → 2.12.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 655072c6be3f9b0fe883178b02266e5f12838157
4
- data.tar.gz: d37bc3d0333cec27246610451dda289ce4a4fbc2
3
+ metadata.gz: 19a014def903ab0e1994fd5c35f882bbfc4d19b4
4
+ data.tar.gz: b02d7ad3224f234b26c3a53039c4f802fc362427
5
5
  SHA512:
6
- metadata.gz: 604bc05ecad569b0791530e48b142a8cc83d4bd97192222b99f69c709c236ac0ff448ee9d4f766de8ea04ea273eecfe29d654405a4d7d3d781a9830f0f025aea
7
- data.tar.gz: 4ceefa024654e05eddfa9efa8e98bc06641e06887045da4b7fb4944f3271789a69cc8d2c0b0cec375a3038aa2ff2113f3c698ccabe8d35f4f3b7a89f4c8f58f0
6
+ metadata.gz: d48e74d74f16124fe1a3db9111071886cbcdb2f92714b75a73534125a6c6ae79697d419a31e99a7aa0546a53075e90c83f4d1ee99ebf979c14667f66375c1125
7
+ data.tar.gz: b8ec4119322934662c75def9c6951b1d27ee10dc9872fa9214f6e511afe4e3e47adc9cd4cde3b7a3addfeaee6cd786f4474c92042c5fe267ff514ebb0c3adba2
data/README.md CHANGED
@@ -26,9 +26,9 @@ Follow [@peterohler on Twitter](http://twitter.com/#!/peterohler) for announceme
26
26
 
27
27
  [![Build Status](https://secure.travis-ci.org/ohler55/oj.png?branch=master)](http://travis-ci.org/ohler55/oj)
28
28
 
29
- ## Future Release 2.12.3
29
+ ## Current Release 2.12.4
30
30
 
31
- - Fixed bug when trying to resolve an invalid class path in object mode load.
31
+ - Fixed memory leak in Oj::Doc when not using a given proc.
32
32
 
33
33
  [Older release notes](http://www.ohler.com/dev/oj_misc/release_notes.html).
34
34
 
@@ -1580,6 +1580,7 @@ doc_close(VALUE self) {
1580
1580
  if (0 != doc) {
1581
1581
  xfree(doc->json);
1582
1582
  doc_free(doc);
1583
+ xfree(doc);
1583
1584
  }
1584
1585
  return Qnil;
1585
1586
  }
@@ -69,9 +69,9 @@ static void next_non_white(ParseInfo pi);
69
69
  static char* read_quoted_value(ParseInfo pi);
70
70
  static void skip_comment(ParseInfo pi);
71
71
 
72
- /* This XML parser is a single pass, destructive, callback parser. It is a
72
+ /* This JSON parser is a single pass, destructive, callback parser. It is a
73
73
  * single pass parse since it only make one pass over the characters in the
74
- * XML document string. It is destructive because it re-uses the content of
74
+ * JSON document string. It is destructive because it re-uses the content of
75
75
  * the string for values in the callback and places \0 characters at various
76
76
  * places to mark the end of tokens and strings. It is a callback parser like
77
77
  * a SAX parser because it uses callback when document elements are
@@ -1,8 +1,8 @@
1
1
  module Oj
2
2
  # A SAX style parse handler for JSON hence the acronym SAJ for Simple API for
3
- # JSON. The Oj::Saj handler class should be subclassed and then used with
4
- # the Oj.sajkey_parse() method. The Saj methods will then be called as the
5
- # file is parsed.
3
+ # JSON. The Oj::Saj handler class should be subclassed and then used with the
4
+ # Oj::Saj key_parse() method. The Saj methods will then be called as the file
5
+ # is parsed.
6
6
  #
7
7
  # @example
8
8
  #
@@ -19,7 +19,7 @@ module Oj
19
19
  # end
20
20
  #
21
21
  # cnt = MySaj.new()
22
- # File.open('any.xml', 'r') do |f|
22
+ # File.open('any.json', 'r') do |f|
23
23
  # Oj.saj_parse(cnt, f)
24
24
  # end
25
25
  #
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.12.3'
4
+ VERSION = '2.12.4'
5
5
  end
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ %w(lib ext test).each do |dir|
5
+ $LOAD_PATH.unshift File.expand_path("../../#{dir}", __FILE__)
6
+ end
7
+
8
+ require 'oj'
9
+
10
+ def create_item(doc)
11
+ #puts "#{doc.fetch('/id')}: #{doc.fetch('/labels/it/value')} - #{doc.fetch('/descriptions/it/value')}"
12
+ doc.fetch('/id')
13
+ doc.fetch('/labels/it/value')
14
+ doc.fetch('/descriptions/it/value')
15
+ end
16
+
17
+ 100.times { |i|
18
+ File.open('dump_10k.json') { |f|
19
+ f.each { |line|
20
+ #Oj::Doc.open(line) { |doc|
21
+ doc = Oj::Doc.open(line)
22
+ begin
23
+ create_item(doc) if doc.fetch('/type') == 'item'
24
+ rescue Exception => e
25
+ puts "*** #{e.class}: #{e.message}"
26
+ end
27
+ doc.close
28
+ #}
29
+ }
30
+ }
31
+ puts i
32
+ }
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ %w(lib ext test).each do |dir|
5
+ $LOAD_PATH.unshift File.expand_path("../../#{dir}", __FILE__)
6
+ end
7
+
8
+ require 'oj'
9
+
10
+ def create_item(doc)
11
+ item_id = doc['source']
12
+ # ...
13
+ puts item_id
14
+ end
15
+
16
+ File.open('log.json') { |f|
17
+ Oj::load(f, mode: :compat) { |doc|
18
+ begin
19
+ create_item(doc) if doc['msgType'] == 1
20
+ rescue Exception => e
21
+ puts "*** #{e.class}: #{e.message}"
22
+ end
23
+ }
24
+ }
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: 2.12.3
4
+ version: 2.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-16 00:00:00.000000000 Z
11
+ date: 2015-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -108,6 +108,8 @@ files:
108
108
  - test/bug.rb
109
109
  - test/bug2.rb
110
110
  - test/bug3.rb
111
+ - test/bug_fast.rb
112
+ - test/bug_load.rb
111
113
  - test/example.rb
112
114
  - test/files.rb
113
115
  - test/helper.rb