moxml 0.5.99 → 0.5.100

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: e0799669e81215c8738217d5d9f75a5cc8842a9a35c92553d07f3f60ee6a8196
4
- data.tar.gz: 86aeb7370ef541cc898fa1f3c9a63ba3da154a7ffb09a68d0236f82a1241fc10
3
+ metadata.gz: a421da0e82158a69de2d25328346153be526d74c6d2bc2bad732427763b175c1
4
+ data.tar.gz: c9d982a98b2ce4984b3ee8659e89f2a4d86484d7e39fec4c04221bd2767473eb
5
5
  SHA512:
6
- metadata.gz: '0932b236b7f6e452705f49c6328848edd315774b35ae47d732a90fa65e5ed98612265765fab4c5bde3ca7eaad79b583457da72e051dbbac3d1df027986105435'
7
- data.tar.gz: 1afbad96dc4a770d0b7c74a23fa55d6d80b2c80a3276bec9ae4b83d10cbda9cb59ae22649634ebfc4c6b49ab7715364396bf387236234372fc93212e4a3d0777
6
+ metadata.gz: 2a3c9a536530f058a8c0a7721a3f192d89be195df277e959d746f2b6360db2da3587c2467fc21222aff85b96c8c3483a6a59406554804e073b25336c6d5dfe17
7
+ data.tar.gz: 750f9751134a3c077bd103edb9b18b0de7ea179d0c27839f1dff22654d372d7eb989a55c154c09ee155ec64d386547885013320eefa4044cb7dccc994d309806
@@ -1793,8 +1793,14 @@ module Moxml
1793
1793
  parent_doc = parent.is_a?(NN) ? NN_DOCUMENT.bind_call(parent) : parent.document
1794
1794
  return if parent_doc.nil? || child_doc.equal?(parent_doc)
1795
1795
 
1796
+ # moxml#308: one source document's children attach
1797
+ # node-by-node — dedup by identity or the pin list grows
1798
+ # linearly with append count (GB-scale malloc on
1799
+ # large-document hydration). Distinct owners stay few.
1796
1800
  owner = child_doc.is_a?(NN) ? to_binding(child_doc) : child_doc
1797
1801
  docs = attachments.get(parent_doc, :adopted_docs) || []
1802
+ return if docs.include?(owner)
1803
+
1798
1804
  docs << owner
1799
1805
  attachments.set(parent_doc, :adopted_docs, docs)
1800
1806
  end
data/lib/moxml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Moxml
4
- VERSION = "0.5.99"
4
+ VERSION = "0.5.100"
5
5
  end
@@ -49,4 +49,18 @@ RSpec.describe "leptris cross-document append under GC pressure" do
49
49
  expect(out).to include("<annex")
50
50
  end
51
51
  end
52
+
53
+ # moxml#308: the pin list must dedup by identity — one source
54
+ # document's children attach node-by-node, and without dedup the
55
+ # list grows linearly with append count (GB-scale malloc on
56
+ # large-document hydration; OOM at 43-75M slots).
57
+ it "pins each adopted document once regardless of append count" do
58
+ target = ctx.parse("<r/>")
59
+ frag = ctx.parse("<m>#{Array.new(300) { |i| "<c#{i}>x</c#{i}>" }.join}</m>")
60
+ frag.root.children.each { |c| target.root.add_child(c) }
61
+
62
+ docs = ctx.config.adapter.attachments.get(target.native.document, :adopted_docs)
63
+ expect(docs.size).to eq(1)
64
+ expect(target.root.to_xml).to include("<c299")
65
+ end
52
66
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moxml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.99
4
+ version: 0.5.100
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.