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 +4 -4
- data/lib/moxml/adapter/leptris.rb +6 -0
- data/lib/moxml/version.rb +1 -1
- data/spec/moxml/adapter/leptris_append_gc_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a421da0e82158a69de2d25328346153be526d74c6d2bc2bad732427763b175c1
|
|
4
|
+
data.tar.gz: c9d982a98b2ce4984b3ee8659e89f2a4d86484d7e39fec4c04221bd2767473eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
@@ -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
|