leptris 1.9.406.0-aarch64-linux → 1.9.407.0-aarch64-linux
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/Rakefile +1 -1
- data/ext/leptris/native/native.c +62 -0
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/attr.rb +20 -5
- data/lib/leptris/xml/descriptor.rb +21 -2
- data/lib/leptris/xml/document.rb +3 -0
- data/lib/leptris/xml/element.rb +5 -3
- data/lib/leptris/xml/native.so +0 -0
- data/lib/leptris/xml/native_3_3.so +0 -0
- data/lib/leptris/xml/native_layer.rb +11 -0
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +13 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/descriptor/plan.c +16 -1
- data/vendor-src/libleptris/src/leptris/memory/arena.c +137 -9
- data/vendor-src/libleptris/src/leptris/memory/arena.h +10 -0
- data/vendor-src/libleptris/test/abi/test_descriptor.cpp +112 -0
- data/vendor-src/libleptris/test/memory/test_arena.cpp +109 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 671ae67147280a94e359cfdfe2fd8a1d86231e6c3a873cf0302adbf1f3582674
|
|
4
|
+
data.tar.gz: 44f83bd4164f3b661c2a54f4fe7a65a981a2102eb032e1f2f1e0eaa6b17a3e4f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a70cdf116de7d3d3eafaba082942021d97a0f3813c79753977a6194452e28acb982eb885195b833a8a1a53768a3656e832a88a7450f203f170a697656a0586e
|
|
7
|
+
data.tar.gz: ef5bef15f6af21ce2e6cfec4b26799d027c66a3e4ab286181d1907966b5edb3a5da2668e6e1c6afc4cd86ba5258d07f3645d67442149137ba982a0a030da2f10
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
8
8
|
# Pin for `rake compile` and the platform-gem builds. Keep in lockstep
|
|
9
9
|
# with .github/workflows/build.yml (which calls `rake compile`) and the
|
|
10
10
|
# CHANGELOG when libleptris releases.
|
|
11
|
-
LIBLEPTRIS_VERSION = "1.9.
|
|
11
|
+
LIBLEPTRIS_VERSION = "1.9.407"
|
|
12
12
|
# Vendored alongside libleptris for fn:normalize-unicode (TODO
|
|
13
13
|
# .restructure/20): built per platform with a RELOCATABLE @rpath
|
|
14
14
|
# install name, loaded by ffi.rb before libleptris so the
|
data/ext/leptris/native/native.c
CHANGED
|
@@ -2840,6 +2840,41 @@ static VALUE nf_walk_addresses(VALUE self, VALUE root)
|
|
|
2840
2840
|
return rb_ary_new3(3, names, addrs, depths);
|
|
2841
2841
|
}
|
|
2842
2842
|
|
|
2843
|
+
/* ---- Raw child addresses (leptris-ruby#587 shadow lane) ----------
|
|
2844
|
+
* The per-node counterpart of walk_addresses: ONE crossing returns
|
|
2845
|
+
* the parent's direct children as raw addresses + node kinds — no
|
|
2846
|
+
* wrapper mint, no identity-cache writes; kinds are the f_children_ex
|
|
2847
|
+
* ints (0 = element). Accepts a NativeNode handle or a raw address
|
|
2848
|
+
* Integer. Read-only consumers pair it with the address-keyed read
|
|
2849
|
+
* faces; a mutable, identity-backed handle mints through the normal
|
|
2850
|
+
* wrap path on first write. */
|
|
2851
|
+
static VALUE nf_children_addrs(VALUE self, VALUE parent)
|
|
2852
|
+
{
|
|
2853
|
+
void **buf;
|
|
2854
|
+
int *kinds;
|
|
2855
|
+
void *ptr;
|
|
2856
|
+
int count, i;
|
|
2857
|
+
VALUE addrs, kind_vals;
|
|
2858
|
+
(void)self;
|
|
2859
|
+
if (RB_INTEGER_TYPE_P(parent)) {
|
|
2860
|
+
ptr = (void *)(uintptr_t)NUM2ULL(parent);
|
|
2861
|
+
} else {
|
|
2862
|
+
struct native_node *n;
|
|
2863
|
+
TypedData_Get_Struct(parent, struct native_node, &nn_type, n);
|
|
2864
|
+
ptr = n->ptr;
|
|
2865
|
+
}
|
|
2866
|
+
count = fetch_children_two_call(ptr, &buf, &kinds);
|
|
2867
|
+
addrs = rb_ary_new2(count > 0 ? count : 0);
|
|
2868
|
+
kind_vals = rb_ary_new2(count > 0 ? count : 0);
|
|
2869
|
+
for (i = 0; i < count; i++) {
|
|
2870
|
+
rb_ary_push(addrs, ULL2NUM((uint64_t)(uintptr_t)buf[i]));
|
|
2871
|
+
rb_ary_push(kind_vals, INT2NUM(kinds[i]));
|
|
2872
|
+
}
|
|
2873
|
+
ruby_xfree(buf);
|
|
2874
|
+
ruby_xfree(kinds);
|
|
2875
|
+
return rb_ary_new3(2, addrs, kind_vals);
|
|
2876
|
+
}
|
|
2877
|
+
|
|
2843
2878
|
/* ---- Struct plan executor (moxml "miles faster" round) ------------
|
|
2844
2879
|
* The consumer's shape compiles to spec: name (interned String) ->
|
|
2845
2880
|
* [Struct class, attrs Hash (name -> slot Symbol), text slot Symbol
|
|
@@ -3255,6 +3290,29 @@ static VALUE nf_attribute_rows(VALUE self, VALUE document, VALUE addr)
|
|
|
3255
3290
|
return out;
|
|
3256
3291
|
}
|
|
3257
3292
|
|
|
3293
|
+
/* ruby#586 ask 1: the flat packet face — [name1, value1, ...] in one
|
|
3294
|
+
* crossing, with no per-attribute Attr/Pointer objects, no slice
|
|
3295
|
+
* arrays and no identity-cache writes. Names interned, values fresh.
|
|
3296
|
+
* Read-only consumers zip the flat array themselves. */
|
|
3297
|
+
static VALUE nf_attribute_packet(VALUE self, VALUE document, VALUE addr)
|
|
3298
|
+
{
|
|
3299
|
+
(void)self;
|
|
3300
|
+
(void)document;
|
|
3301
|
+
void *node = (void *)(uintptr_t)NUM2ULL(addr);
|
|
3302
|
+
VALUE out = rb_ary_new();
|
|
3303
|
+
if (f_node_type(node) != WS_NODE_ELEMENT) return out;
|
|
3304
|
+
|
|
3305
|
+
for (void *a = f_attr_first(node); a; a = f_attr_next(a)) {
|
|
3306
|
+
const char *an = f_attr_name(a);
|
|
3307
|
+
const char *av = f_attr_value(node, a);
|
|
3308
|
+
rb_ary_push(out, an ? rb_enc_interned_str(an, strlen(an),
|
|
3309
|
+
rb_utf8_encoding())
|
|
3310
|
+
: Qnil);
|
|
3311
|
+
rb_ary_push(out, av ? rb_utf8_str_new_cstr(av) : Qnil);
|
|
3312
|
+
}
|
|
3313
|
+
return out;
|
|
3314
|
+
}
|
|
3315
|
+
|
|
3258
3316
|
static VALUE nf_plan_structs(VALUE self, VALUE document, VALUE addr,
|
|
3259
3317
|
VALUE spec)
|
|
3260
3318
|
{
|
|
@@ -4260,12 +4318,16 @@ static void leptris_native_setup(void)
|
|
|
4260
4318
|
nf_walk_columnar, 1);
|
|
4261
4319
|
rb_define_module_function(m_native, "walk_addresses",
|
|
4262
4320
|
nf_walk_addresses, 1);
|
|
4321
|
+
rb_define_module_function(m_native, "children_addrs",
|
|
4322
|
+
nf_children_addrs, 1);
|
|
4263
4323
|
rb_define_module_function(m_native, "attribute_pairs",
|
|
4264
4324
|
nf_attribute_pairs, 2);
|
|
4265
4325
|
rb_define_module_function(m_native, "plan_structs",
|
|
4266
4326
|
nf_plan_structs, 3);
|
|
4267
4327
|
rb_define_module_function(m_native, "attribute_rows",
|
|
4268
4328
|
nf_attribute_rows, 2);
|
|
4329
|
+
rb_define_module_function(m_native, "attribute_packet",
|
|
4330
|
+
nf_attribute_packet, 2);
|
|
4269
4331
|
rb_define_module_function(m_native, "create_element_with_attrs",
|
|
4270
4332
|
nf_create_element_with_attrs, 4);
|
|
4271
4333
|
rb_define_module_function(m_native, "register_doc_klasses",
|
data/lib/leptris/version.rb
CHANGED
data/lib/leptris/xml/attr.rb
CHANGED
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
class Leptris::XML::Attr
|
|
9
9
|
attr_reader :name, :value, :element
|
|
10
10
|
|
|
11
|
-
# c_handle is the C LeptrisAttribute
|
|
12
|
-
# element's iteration face — document-owned and borrowed.
|
|
13
|
-
#
|
|
11
|
+
# c_handle is the C LeptrisAttribute handle from the owning
|
|
12
|
+
# element's iteration face — document-owned and borrowed. The rows
|
|
13
|
+
# faces pass the raw Integer address (ruby#586 ask 2: no
|
|
14
|
+
# per-attribute FFI::Pointer on read-only callers); the Pointer is
|
|
15
|
+
# minted lazily on the first namespace read. Hand constructors may
|
|
16
|
+
# pass a Pointer directly, or nil when constructed by hand.
|
|
14
17
|
def initialize(name, value, element, c_handle: nil)
|
|
15
18
|
@name = name
|
|
16
19
|
@value = value
|
|
@@ -37,8 +40,9 @@ class Leptris::XML::Attr
|
|
|
37
40
|
# nil for a no-namespace attribute or an undeclared prefix; xml
|
|
38
41
|
# is prebound to http://www.w3.org/XML/1998/namespace.
|
|
39
42
|
def namespace_uri
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
h = c_handle_ptr
|
|
44
|
+
return nil if h.nil?
|
|
45
|
+
Leptris::XML::FFI.leptris_attribute_namespace_uri(h)
|
|
42
46
|
end
|
|
43
47
|
|
|
44
48
|
def namespace
|
|
@@ -73,4 +77,15 @@ class Leptris::XML::Attr
|
|
|
73
77
|
def inspect
|
|
74
78
|
"#<#{self.class.name} name=#{@name.inspect} value=#{@value.inspect}>"
|
|
75
79
|
end
|
|
80
|
+
|
|
81
|
+
private
|
|
82
|
+
|
|
83
|
+
# Wrap a raw Integer address on first namespace read; Pointer and
|
|
84
|
+
# nil pass through unchanged.
|
|
85
|
+
def c_handle_ptr
|
|
86
|
+
if @c_handle.is_a?(Integer)
|
|
87
|
+
@c_handle = @c_handle.zero? ? nil : FFI::Pointer.new(@c_handle)
|
|
88
|
+
end
|
|
89
|
+
@c_handle
|
|
90
|
+
end
|
|
76
91
|
end
|
|
@@ -166,7 +166,14 @@ class Leptris::XML::Descriptor
|
|
|
166
166
|
tree_index = plans.size - 1
|
|
167
167
|
memo[key] = tree_index
|
|
168
168
|
duped[:children] = (duped[:children] || []).map do |row|
|
|
169
|
-
|
|
169
|
+
# leptris#1966: :ordered_deferred rows carry child :plan trees
|
|
170
|
+
# exactly like :nested rows (lutaml's emission_rows_for
|
|
171
|
+
# materializes the deferred subtree) — skipping them here
|
|
172
|
+
# left deferred subtrees WITHOUT descriptor slots, so the
|
|
173
|
+
# slot numbering diverged from the emission graph at the
|
|
174
|
+
# first deferred row and the ops' plan_index pointed at the
|
|
175
|
+
# wrong plan (engine status=-5 on the theme/styles shapes).
|
|
176
|
+
if row[:kind] == :nested || row[:kind] == :ordered_deferred
|
|
170
177
|
row.merge(child_plan_index: flatten_plan(row.fetch(:plan), plans,
|
|
171
178
|
memo))
|
|
172
179
|
else
|
|
@@ -426,8 +433,20 @@ class Leptris::XML::Descriptor
|
|
|
426
433
|
raw = Leptris::XML::FFI.leptris_plan_result_build(
|
|
427
434
|
@handle, memory, ops.size, status)
|
|
428
435
|
if raw.null?
|
|
436
|
+
# leptris#1966 ask 2: the bare "status=-5" sent three consumers
|
|
437
|
+
# hunting an ABI bug that did not exist. Carry the op-stream
|
|
438
|
+
# shape — op count, plan count, and the ops at the highest
|
|
439
|
+
# plan_index — so an out-of-range reference is visible at a
|
|
440
|
+
# glance.
|
|
441
|
+
max_pi = ops.filter_map { |o| o[:plan_index] }.max
|
|
442
|
+
at_max = ops.each_index
|
|
443
|
+
.select { |i| ops[i][:plan_index] == max_pi }
|
|
444
|
+
.first(3)
|
|
429
445
|
raise Leptris::XML::Error,
|
|
430
|
-
"plan result build failed (status=#{status.read_int}
|
|
446
|
+
"plan result build failed (status=#{status.read_int}; " \
|
|
447
|
+
"ops=#{ops.size} plans=#{@plans.size} " \
|
|
448
|
+
"max_plan_index=#{max_pi.inspect} " \
|
|
449
|
+
"ops_at_max=#{at_max.map { |i| [i, ops[i][:kind], ops[i][:row_index]] }.inspect})"
|
|
431
450
|
end
|
|
432
451
|
Leptris::XML::PlanValue.new(ResultHandle.new(raw),
|
|
433
452
|
owner: true, plans: @plans, plan: @plans[0])
|
data/lib/leptris/xml/document.rb
CHANGED
|
@@ -714,6 +714,9 @@ class Leptris::XML::Document
|
|
|
714
714
|
@c_ptr = nil
|
|
715
715
|
@c_address = nil
|
|
716
716
|
@wrapper_cache&.clear
|
|
717
|
+
# ruby#587: release the native identity cache at free time —
|
|
718
|
+
# the wrapper set dies with the document, not at GC time.
|
|
719
|
+
@native_cache = nil
|
|
717
720
|
# Detach the lifetime handle (TODO.perf/12): the memory is
|
|
718
721
|
# already released above — the GC-pass dfree must no-op.
|
|
719
722
|
Leptris::XML::Native.doc_handle_release(self) if defined?(Leptris::XML::NATIVE_FAST)
|
data/lib/leptris/xml/element.rb
CHANGED
|
@@ -411,13 +411,15 @@ class Leptris::XML::Element < Leptris::XML::Node
|
|
|
411
411
|
# address] triples; the Attr value objects are minted from them
|
|
412
412
|
# with zero further engine crossings — identical objects to
|
|
413
413
|
# each_attribute. The win amplifies with attribute density
|
|
414
|
-
# (40-attr elements list ~7x faster than the chain).
|
|
414
|
+
# (40-attr elements list ~7x faster than the chain). The raw
|
|
415
|
+
# Integer address rides along (ruby#586 ask 2) — the FFI::Pointer
|
|
416
|
+
# is minted lazily on the first namespace read, so read-only
|
|
417
|
+
# walkers stop paying one Pointer per attribute.
|
|
415
418
|
def attribute_rows_native
|
|
416
419
|
::Leptris::XML::Native.attribute_rows(@document, @c_address)
|
|
417
420
|
.each_slice(3)
|
|
418
421
|
.map do |name, value, handle|
|
|
419
|
-
::Leptris::XML::Attr.new(name, value, self,
|
|
420
|
-
c_handle: ::FFI::Pointer.new(handle))
|
|
422
|
+
::Leptris::XML::Attr.new(name, value, self, c_handle: handle)
|
|
421
423
|
end
|
|
422
424
|
end
|
|
423
425
|
|
data/lib/leptris/xml/native.so
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -105,6 +105,17 @@ class Leptris::XML::Document
|
|
|
105
105
|
@native_cache ||= {}
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
+
# ruby#587 ask 2: documented drop point for the identity cache —
|
|
109
|
+
# a parse -> hydrate -> discard lane releases the retained wrapper
|
|
110
|
+
# set without waiting for document GC. Surviving wrappers stay
|
|
111
|
+
# valid (they carry their own document + address); new crossings
|
|
112
|
+
# mint fresh wrappers, so the object-identity contract ends where
|
|
113
|
+
# the host says it ends.
|
|
114
|
+
def clear_native_cache
|
|
115
|
+
@native_cache = nil
|
|
116
|
+
self
|
|
117
|
+
end
|
|
118
|
+
|
|
108
119
|
def native_node
|
|
109
120
|
r = root or raise Leptris::XML::Error, "document has no root element"
|
|
110
121
|
Leptris::XML::NativeNode.from(self, r.c_ptr)
|
data/lib/libleptris.so
CHANGED
|
Binary file
|
data/vendor-src/README.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.407] - 2026-11-05
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- deep-copy attr and element ns_prefix past the spec buffers (descriptor)
|
|
8
|
+
- keep sys/mman.h off the Windows include path (memory)
|
|
9
|
+
|
|
10
|
+
### Performance
|
|
11
|
+
|
|
12
|
+
- oversized arena spans return to the OS on drop (#1947) (memory)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
3
16
|
## [1.9.406] - 2026-11-03
|
|
4
17
|
|
|
5
18
|
### Added
|
|
@@ -370,6 +370,7 @@ static void dp_plan_free(LeptrisPlan p) {
|
|
|
370
370
|
for (uint32_t a = 0; a < d->attribute_count; a++) {
|
|
371
371
|
free((char *)d->attribute_plans[a].wire_name);
|
|
372
372
|
free((char *)d->attribute_plans[a].ns_uri);
|
|
373
|
+
free((char *)d->attribute_plans[a].ns_prefix);
|
|
373
374
|
for (uint16_t pi = 0;
|
|
374
375
|
pi < d->attribute_plans[a].predicate_count; pi++) {
|
|
375
376
|
free((char*)d->attribute_plans[a]
|
|
@@ -449,9 +450,12 @@ LEPTRIS_API LeptrisPlan leptris_plan_build(const leptris_plan_spec* spec,
|
|
|
449
450
|
if (s->ns_uri) {
|
|
450
451
|
d->ns_uri = dp_strdup(s->ns_uri);
|
|
451
452
|
if (!d->ns_uri) goto oom;
|
|
453
|
+
}
|
|
454
|
+
/* #1967: the prefix must copy OUTSIDE the ns_uri branch — a
|
|
455
|
+
* plan carrying a prefix with no URI otherwise keeps the
|
|
456
|
+
* caller's anchor pointer. */
|
|
452
457
|
d->ns_prefix = s->ns_prefix ? dp_strdup(s->ns_prefix) : NULL;
|
|
453
458
|
if (s->ns_prefix && !d->ns_prefix) goto oom;
|
|
454
|
-
}
|
|
455
459
|
d->flags = s->flags;
|
|
456
460
|
|
|
457
461
|
if (s->attribute_count) {
|
|
@@ -508,6 +512,17 @@ LEPTRIS_API LeptrisPlan leptris_plan_build(const leptris_plan_spec* spec,
|
|
|
508
512
|
dp_strdup(s->attribute_plans[a].wire_name);
|
|
509
513
|
if (!d->attribute_plans[a].wire_name) goto oom;
|
|
510
514
|
}
|
|
515
|
+
/* #1967: attr ns_prefix rode the struct copy — a
|
|
516
|
+
* dangling pointer into the caller's build buffers
|
|
517
|
+
* once the bindings GC their anchors (the #1585
|
|
518
|
+
* lesson; child rows already retain). */
|
|
519
|
+
d->attribute_plans[a].ns_prefix =
|
|
520
|
+
s->attribute_plans[a].ns_prefix
|
|
521
|
+
? dp_strdup(s->attribute_plans[a].ns_prefix)
|
|
522
|
+
: NULL;
|
|
523
|
+
if (s->attribute_plans[a].ns_prefix &&
|
|
524
|
+
!d->attribute_plans[a].ns_prefix)
|
|
525
|
+
goto oom;
|
|
511
526
|
uint16_t pc = s->attribute_plans[a].predicate_count;
|
|
512
527
|
if (pc) {
|
|
513
528
|
if (!s->attribute_plans[a].predicates) goto oom;
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
/* lib/src/memory/arena.c — Contiguous per-document arena (TODO 183)
|
|
2
2
|
* Copyright (c) 2024, Ribose Inc.
|
|
3
3
|
*/
|
|
4
|
+
/* glibc hides MAP_ANONYMOUS under -std=c99 (__STRICT_ANSI__); the
|
|
5
|
+
* feature-test macros must precede every include of this TU. The
|
|
6
|
+
* build adds _POSIX_C_SOURCE=200809L publicly, which puts Apple's
|
|
7
|
+
* headers in strict mode — _DARWIN_C_SOURCE restores the BSD names
|
|
8
|
+
* (MAP_ANON/MAP_ANONYMOUS) there. */
|
|
9
|
+
#if defined(__linux__) && !defined(_DEFAULT_SOURCE)
|
|
10
|
+
#define _DEFAULT_SOURCE 1
|
|
11
|
+
#endif
|
|
12
|
+
#if defined(__APPLE__) && !defined(_DARWIN_C_SOURCE)
|
|
13
|
+
#define _DARWIN_C_SOURCE 1
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
/* ---- #1947 lever 2: direct (anonymous-mmap) spans ---------------------
|
|
17
|
+
*
|
|
18
|
+
* A span above the retain budget can never be parked (retain_give
|
|
19
|
+
* frees it unconditionally), so acquiring it through malloc buys
|
|
20
|
+
* nothing and the freed pages linger in allocator magazines — the
|
|
21
|
+
* ~2 GB post-drop residency the XMI/CityGML pipeline reports. Oversized
|
|
22
|
+
* spans are taken mmap-direct and returned with munmap on destroy, so
|
|
23
|
+
* the drop face collapses RSS deterministically.
|
|
24
|
+
*
|
|
25
|
+
* Stands down under ASAN (the malloc path keeps use-after-free visible
|
|
26
|
+
* to the shadow) and under custom allocators (hooked accounting must
|
|
27
|
+
* see every byte the library takes). Within-budget spans keep the
|
|
28
|
+
* park-and-reuse lane — the repeated-parse fault fix depends on it. */
|
|
29
|
+
#if defined(_WIN32)
|
|
30
|
+
#define LEPTRIS_HAS_DIRECT_SPANS 1
|
|
31
|
+
#elif !defined(__wasm__) && !defined(__EMSCRIPTEN__) && \
|
|
32
|
+
(defined(__unix__) || defined(__APPLE__) || defined(__MACH__))
|
|
33
|
+
#define LEPTRIS_HAS_DIRECT_SPANS 1
|
|
34
|
+
#endif
|
|
35
|
+
|
|
4
36
|
#include "arena.h"
|
|
5
37
|
|
|
6
38
|
#include "../common/port.h" /* LEPTRIS_THREAD_LOCAL */
|
|
@@ -8,8 +40,19 @@
|
|
|
8
40
|
#include <stdlib.h>
|
|
9
41
|
#include <stdio.h>
|
|
10
42
|
#include <string.h>
|
|
11
|
-
#if defined(__linux__)
|
|
12
|
-
|
|
43
|
+
#if defined(__linux__) || \
|
|
44
|
+
(defined(LEPTRIS_HAS_DIRECT_SPANS) && !defined(_WIN32))
|
|
45
|
+
#include <sys/mman.h> /* madvise(MADV_HUGEPAGE), mmap/munmap */
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#if defined(_WIN32)
|
|
49
|
+
#include <windows.h>
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
/* BSD headers name it MAP_ANON; the POSIX spelling may be absent. */
|
|
53
|
+
#if defined(LEPTRIS_HAS_DIRECT_SPANS) && !defined(MAP_ANONYMOUS) && \
|
|
54
|
+
defined(MAP_ANON)
|
|
55
|
+
#define MAP_ANONYMOUS MAP_ANON
|
|
13
56
|
#endif
|
|
14
57
|
|
|
15
58
|
/* Allocation hooks (core.c): honoring the public
|
|
@@ -296,6 +339,66 @@ char* leptris_arena_buffer_alloc(size_t size) {
|
|
|
296
339
|
return base ? base : (char*)leptris_alloc_hook(size);
|
|
297
340
|
}
|
|
298
341
|
|
|
342
|
+
/* ---- Direct-span transport (#1947) ----------------------------------- */
|
|
343
|
+
|
|
344
|
+
static size_t g_span_direct_taken;
|
|
345
|
+
static size_t g_span_direct_released;
|
|
346
|
+
|
|
347
|
+
int leptris_arena_has_direct_spans(void) {
|
|
348
|
+
#if defined(LEPTRIS_HAS_DIRECT_SPANS)
|
|
349
|
+
return 1;
|
|
350
|
+
#else
|
|
351
|
+
return 0;
|
|
352
|
+
#endif
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
void leptris_arena_span_stats(size_t* direct_taken, size_t* direct_released) {
|
|
356
|
+
if (direct_taken) *direct_taken = g_span_direct_taken;
|
|
357
|
+
if (direct_released) *direct_released = g_span_direct_released;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
#if defined(_WIN32)
|
|
361
|
+
|
|
362
|
+
static int span_direct_acquire(char** out, size_t size) {
|
|
363
|
+
void* p = VirtualAlloc(NULL, size, MEM_RESERVE | MEM_COMMIT,
|
|
364
|
+
PAGE_READWRITE);
|
|
365
|
+
if (!p) return 0;
|
|
366
|
+
*out = (char*)p;
|
|
367
|
+
return 1;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
static void span_direct_release(char* base, size_t size) {
|
|
371
|
+
(void)size;
|
|
372
|
+
VirtualFree(base, 0, MEM_RELEASE);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
#elif defined(LEPTRIS_HAS_DIRECT_SPANS)
|
|
376
|
+
|
|
377
|
+
static int span_direct_acquire(char** out, size_t size) {
|
|
378
|
+
void* p = mmap(NULL, size, PROT_READ | PROT_WRITE,
|
|
379
|
+
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
|
380
|
+
if (p == MAP_FAILED) return 0;
|
|
381
|
+
*out = (char*)p;
|
|
382
|
+
return 1;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
static void span_direct_release(char* base, size_t size) {
|
|
386
|
+
munmap(base, size);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
#else
|
|
390
|
+
|
|
391
|
+
static int span_direct_acquire(char** out, size_t size) {
|
|
392
|
+
(void)out; (void)size;
|
|
393
|
+
return 0;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
static void span_direct_release(char* base, size_t size) {
|
|
397
|
+
(void)base; (void)size;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
#endif
|
|
401
|
+
|
|
299
402
|
void leptris_arena_buffer_release(void* p, size_t size) {
|
|
300
403
|
if (!p) return;
|
|
301
404
|
retain_give((char*)p, size);
|
|
@@ -335,13 +438,30 @@ LeptrisArena* leptris_arena_create(size_t size) {
|
|
|
335
438
|
return NULL;
|
|
336
439
|
size_t want = size + hdr;
|
|
337
440
|
size_t capacity = want;
|
|
338
|
-
char* span =
|
|
339
|
-
|
|
340
|
-
|
|
441
|
+
char* span = NULL;
|
|
442
|
+
int direct = 0;
|
|
443
|
+
#ifndef ARENA_RETAIN_ASAN
|
|
444
|
+
/* #1947: above the retain budget the span can never be parked, so
|
|
445
|
+
* the libc lane only adds magazine residency. Take it direct. */
|
|
446
|
+
if (want > ARENA_RETAIN_MAX_BYTES && !leptris_custom_allocator_active() &&
|
|
447
|
+
span_direct_acquire(&span, want)) {
|
|
341
448
|
capacity = want;
|
|
342
|
-
|
|
449
|
+
direct = 1;
|
|
450
|
+
retain_lock();
|
|
451
|
+
g_span_direct_taken++;
|
|
452
|
+
retain_unlock();
|
|
343
453
|
arena_advise_hugepages(span, capacity);
|
|
344
454
|
}
|
|
455
|
+
#endif
|
|
456
|
+
if (!span) {
|
|
457
|
+
span = retain_take(want, &capacity);
|
|
458
|
+
if (!span) {
|
|
459
|
+
span = (char*)leptris_alloc_hook(want);
|
|
460
|
+
capacity = want;
|
|
461
|
+
if (!span) return NULL;
|
|
462
|
+
arena_advise_hugepages(span, capacity);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
345
465
|
LeptrisArena* arena = (LeptrisArena*)span;
|
|
346
466
|
arena->span = span;
|
|
347
467
|
arena->base = span + hdr;
|
|
@@ -351,6 +471,7 @@ LeptrisArena* leptris_arena_create(size_t size) {
|
|
|
351
471
|
arena->size = capacity - hdr;
|
|
352
472
|
arena->used = 0;
|
|
353
473
|
arena->failed = 0;
|
|
474
|
+
arena->direct = direct;
|
|
354
475
|
return arena;
|
|
355
476
|
}
|
|
356
477
|
|
|
@@ -364,9 +485,16 @@ void leptris_arena_destroy(LeptrisArena* arena) {
|
|
|
364
485
|
if (!arena) return;
|
|
365
486
|
/* The header lives inside the span — releasing the block
|
|
366
487
|
* releases everything. */
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
488
|
+
const size_t hdr = (sizeof(LeptrisArena) + ARENA_ALIGNMENT - 1) &
|
|
489
|
+
~(ARENA_ALIGNMENT - 1);
|
|
490
|
+
if (arena->direct) {
|
|
491
|
+
span_direct_release(arena->span, arena->size + hdr);
|
|
492
|
+
retain_lock();
|
|
493
|
+
g_span_direct_released++;
|
|
494
|
+
retain_unlock();
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
retain_give(arena->span, arena->size + hdr);
|
|
370
498
|
}
|
|
371
499
|
|
|
372
500
|
void* leptris_arena_alloc(LeptrisArena* arena, size_t size) {
|
|
@@ -39,6 +39,8 @@ typedef struct leptris_arena {
|
|
|
39
39
|
size_t size; /* Bump-region capacity (span capacity minus header) */
|
|
40
40
|
size_t used; /* Bump pointer — bytes handed out so far */
|
|
41
41
|
size_t failed; /* 1 once any request has been refused (sticky) */
|
|
42
|
+
int direct; /* 1 when the span is an anonymous mmap owned by the
|
|
43
|
+
* arena — destroy must munmap, not park or free */
|
|
42
44
|
} LeptrisArena;
|
|
43
45
|
|
|
44
46
|
/* Create an arena of `size` bytes (one malloc). Returns NULL on
|
|
@@ -59,6 +61,14 @@ void leptris_arena_destroy(LeptrisArena* arena);
|
|
|
59
61
|
/* Release retained arena blocks (leptris_thread_cleanup drain). */
|
|
60
62
|
void leptris_arena_retain_drain(void);
|
|
61
63
|
|
|
64
|
+
/* #1947 lever 2: spans above the retain budget never park, so they
|
|
65
|
+
* bypass the libc allocator — anonymous mmap on acquire, munmap on
|
|
66
|
+
* destroy — and a dropped document's pages return to the OS
|
|
67
|
+
* deterministically instead of lingering in allocator magazines.
|
|
68
|
+
* Internal observability for specs; not part of the public ABI. */
|
|
69
|
+
int leptris_arena_has_direct_spans(void);
|
|
70
|
+
void leptris_arena_span_stats(size_t* direct_taken, size_t* direct_released);
|
|
71
|
+
|
|
62
72
|
/* Bump-allocate `size` bytes, 8-byte aligned. NOT zeroed.
|
|
63
73
|
* Returns NULL when the request does not fit in remaining space —
|
|
64
74
|
* no fallback allocation, ever (see the contract above). */
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include <leptris.h>
|
|
9
9
|
#include <leptris/descriptor.h>
|
|
10
10
|
#include <cstring>
|
|
11
|
+
#include <cstdio>
|
|
11
12
|
#include <string>
|
|
12
13
|
|
|
13
14
|
namespace {
|
|
@@ -785,6 +786,117 @@ TEST(PlanBuild, CopiesTheSpecStrings) {
|
|
|
785
786
|
leptris_document_free(doc);
|
|
786
787
|
}
|
|
787
788
|
|
|
789
|
+
/* #1967: every spec string the plan carries must be retained past
|
|
790
|
+
* build — the bindings anchor ns_prefix in FFI buffers that die with
|
|
791
|
+
* the build call, so a struct-copied pointer reads freed heap bytes
|
|
792
|
+
* at serialize time. The attr row's ns_prefix missed the dp_strdup
|
|
793
|
+
* the element plans (#1551) and child rows (#1585) already had, and
|
|
794
|
+
* the element plan's copy sat inside the ns_uri branch (a prefix
|
|
795
|
+
* with no URI never copied). Mirrors CopiesTheSpecStrings: the spec
|
|
796
|
+
* buffers are freed right after build, then the plan serializes. */
|
|
797
|
+
TEST(PlanBuild, CopiesAttrAndElementNsPrefixesPastSpecFree) {
|
|
798
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
799
|
+
|
|
800
|
+
/* Heap-anchored like the bindings' FFI::MemoryPointer strings:
|
|
801
|
+
* freed the moment build returns, so a retained pointer reads
|
|
802
|
+
* freed heap bytes. (Stack buffers would survive the whole test
|
|
803
|
+
* and hide the defect.) */
|
|
804
|
+
char* root_prefix_buf = strdup("w");
|
|
805
|
+
char* attr_name_buf = strdup("val");
|
|
806
|
+
char* attr_prefix_buf = strdup("w");
|
|
807
|
+
|
|
808
|
+
leptris_attr_plan* attrs =
|
|
809
|
+
(leptris_attr_plan*)calloc(1, sizeof(leptris_attr_plan));
|
|
810
|
+
attrs[0].wire_name = attr_name_buf;
|
|
811
|
+
attrs[0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
812
|
+
attrs[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
813
|
+
attrs[0].ns_uri = "urn:w";
|
|
814
|
+
attrs[0].ns_prefix = attr_prefix_buf;
|
|
815
|
+
|
|
816
|
+
/* Element plan: prefix WITHOUT a uri — the un-nesting defect. */
|
|
817
|
+
leptris_element_plan* plans =
|
|
818
|
+
(leptris_element_plan*)calloc(1, sizeof(leptris_element_plan));
|
|
819
|
+
plans[0].element_name = "updateFields";
|
|
820
|
+
plans[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
821
|
+
plans[0].ns_uri = "urn:w";
|
|
822
|
+
plans[0].ns_prefix = root_prefix_buf;
|
|
823
|
+
plans[0].attribute_count = 1;
|
|
824
|
+
plans[0].attribute_plans = attrs;
|
|
825
|
+
|
|
826
|
+
leptris_plan_spec spec = {};
|
|
827
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
828
|
+
spec.plan_count = 1;
|
|
829
|
+
spec.plans = plans;
|
|
830
|
+
|
|
831
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
832
|
+
ASSERT_NE(plan, nullptr);
|
|
833
|
+
/* Anchor drop: the bindings free their buffers as soon as build
|
|
834
|
+
* returns. */
|
|
835
|
+
free(attrs);
|
|
836
|
+
free(plans);
|
|
837
|
+
free(root_prefix_buf);
|
|
838
|
+
free(attr_name_buf);
|
|
839
|
+
free(attr_prefix_buf);
|
|
840
|
+
|
|
841
|
+
leptris_plan_row_op ops[3] = {};
|
|
842
|
+
ops[0].kind = LEPTRIS_PLAN_OP_ELEMENT;
|
|
843
|
+
ops[0].row_index = 0xFFFFFFFFu;
|
|
844
|
+
ops[1].kind = LEPTRIS_PLAN_OP_ATTR;
|
|
845
|
+
ops[1].row_index = 0;
|
|
846
|
+
ops[1].name = "val";
|
|
847
|
+
ops[1].value = "0";
|
|
848
|
+
ops[1].value_len = 1;
|
|
849
|
+
ops[2].kind = LEPTRIS_PLAN_OP_END;
|
|
850
|
+
|
|
851
|
+
/* Two serializations: the first may still read live bytes; the
|
|
852
|
+
* second runs after churn has had a chance to reuse the freed
|
|
853
|
+
* buffers' memory. */
|
|
854
|
+
for (int round = 0; round < 2; round++) {
|
|
855
|
+
if (round == 1) {
|
|
856
|
+
/* Churn through the plan-build allocation paths
|
|
857
|
+
* themselves (the repro that surfaced #1967): build and
|
|
858
|
+
* drop descriptors so their internal dp_strdup traffic
|
|
859
|
+
* consumes and rewrites the freed anchor chunks. Plain
|
|
860
|
+
* strdup cycles do not reliably reuse them under
|
|
861
|
+
* macOS's nano allocator. */
|
|
862
|
+
for (int i = 0; i < 50; i++) {
|
|
863
|
+
leptris_element_plan churn_plans[8] = {};
|
|
864
|
+
leptris_child_plan churn_kids[8][1] = {};
|
|
865
|
+
for (int j = 0; j < 8; j++) {
|
|
866
|
+
churn_plans[j].element_name = "elem";
|
|
867
|
+
churn_plans[j].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
868
|
+
churn_plans[j].ns_uri = "urn:w";
|
|
869
|
+
churn_plans[j].ns_prefix = "wx";
|
|
870
|
+
churn_plans[j].child_count = 1;
|
|
871
|
+
churn_plans[j].child_plans = churn_kids[j];
|
|
872
|
+
churn_kids[j][0].wire_name = "CT_RPr";
|
|
873
|
+
churn_kids[j][0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
874
|
+
churn_kids[j][0].child_plan_index = -1;
|
|
875
|
+
}
|
|
876
|
+
leptris_plan_spec churn_spec = {};
|
|
877
|
+
churn_spec.abi_version = leptris_plan_abi_version();
|
|
878
|
+
churn_spec.plan_count = 8;
|
|
879
|
+
churn_spec.plans = churn_plans;
|
|
880
|
+
LeptrisPlan churned = leptris_plan_build(&churn_spec, &st);
|
|
881
|
+
ASSERT_NE(churned, nullptr);
|
|
882
|
+
leptris_plan_free(churned);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
LeptrisPlanResult r =
|
|
886
|
+
leptris_plan_result_build(plan, ops, 3, &st);
|
|
887
|
+
ASSERT_NE(r, nullptr);
|
|
888
|
+
char* out = leptris_plan_serialize(plan, r, &st);
|
|
889
|
+
ASSERT_NE(out, nullptr);
|
|
890
|
+
EXPECT_STREQ(out,
|
|
891
|
+
"<w:updateFields xmlns:w=\"urn:w\" w:val=\"0\"/>")
|
|
892
|
+
<< "round " << round;
|
|
893
|
+
leptris_free_string(out);
|
|
894
|
+
leptris_plan_result_free(r);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
leptris_plan_free(plan);
|
|
898
|
+
}
|
|
899
|
+
|
|
788
900
|
TEST(PlanAccessors, NullTolerant) {
|
|
789
901
|
EXPECT_EQ(leptris_plan_value_kind(nullptr), LEPTRIS_PLAN_VALUE_ELEMENT);
|
|
790
902
|
EXPECT_EQ(leptris_plan_value_name(nullptr), nullptr);
|
|
@@ -415,3 +415,112 @@ TEST(LeptrisArena, SameSizeReuseSurvivesMixedSizeTraffic) {
|
|
|
415
415
|
leptris_arena_destroy(h);
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
+
|
|
419
|
+
// ---- #1947 lever 2: oversized spans bypass the libc allocator ------
|
|
420
|
+
// A span above the retain budget can never be parked (retain_give
|
|
421
|
+
// frees it unconditionally), so acquiring it through malloc buys
|
|
422
|
+
// nothing and the freed pages linger in allocator magazines — the
|
|
423
|
+
// ~2 GB post-drop residency the CityGML pipeline reports. Spans over
|
|
424
|
+
// ARENA_RETAIN_MAX_BYTES are taken mmap-direct and returned with
|
|
425
|
+
// munmap on destroy, so the drop face collapses RSS deterministically.
|
|
426
|
+
//
|
|
427
|
+
// The stats hook counts direct spans; it is internal (arena.h) — the
|
|
428
|
+
// public ABI surface is untouched.
|
|
429
|
+
TEST(ArenaDirectSpans, OversizedCreateGoesDirectNotMalloc) {
|
|
430
|
+
#if defined(ARENA_TESTS_ASAN)
|
|
431
|
+
GTEST_SKIP() << "direct spans disabled under ASAN (malloc path keeps UAF visible)";
|
|
432
|
+
#endif
|
|
433
|
+
if (!leptris_arena_has_direct_spans())
|
|
434
|
+
GTEST_SKIP() << "platform has no anonymous-mmap span path";
|
|
435
|
+
leptris_arena_retain_drain();
|
|
436
|
+
size_t taken0 = 0, released0 = 0;
|
|
437
|
+
leptris_arena_span_stats(&taken0, &released0);
|
|
438
|
+
|
|
439
|
+
const size_t kBig = 128u * 1024u * 1024u; /* > ARENA_RETAIN_MAX_BYTES */
|
|
440
|
+
LeptrisArena* a = leptris_arena_create(kBig);
|
|
441
|
+
ASSERT_NE(a, nullptr);
|
|
442
|
+
/* The bump region must still offer the full budget — direct
|
|
443
|
+
* acquisition is a transport swap, not a capacity change. */
|
|
444
|
+
EXPECT_EQ(leptris_arena_remaining(a), kBig);
|
|
445
|
+
|
|
446
|
+
size_t taken1 = 0, released1 = 0;
|
|
447
|
+
leptris_arena_span_stats(&taken1, &released1);
|
|
448
|
+
EXPECT_EQ(taken1, taken0 + 1) << "oversized span was not taken direct";
|
|
449
|
+
EXPECT_EQ(released1, released0);
|
|
450
|
+
leptris_arena_destroy(a);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
TEST(ArenaDirectSpans, OversizedDestroyMunmapsInsteadOfParking) {
|
|
454
|
+
#if defined(ARENA_TESTS_ASAN)
|
|
455
|
+
GTEST_SKIP() << "direct spans disabled under ASAN (malloc path keeps UAF visible)";
|
|
456
|
+
#endif
|
|
457
|
+
if (!leptris_arena_has_direct_spans())
|
|
458
|
+
GTEST_SKIP() << "platform has no anonymous-mmap span path";
|
|
459
|
+
leptris_arena_retain_drain();
|
|
460
|
+
size_t taken0 = 0, released0 = 0;
|
|
461
|
+
leptris_arena_span_stats(&taken0, &released0);
|
|
462
|
+
|
|
463
|
+
const size_t kBig = 128u * 1024u * 1024u;
|
|
464
|
+
LeptrisArena* a = leptris_arena_create(kBig);
|
|
465
|
+
ASSERT_NE(a, nullptr);
|
|
466
|
+
leptris_arena_destroy(a);
|
|
467
|
+
|
|
468
|
+
size_t taken1 = 0, released1 = 0;
|
|
469
|
+
leptris_arena_span_stats(&taken1, &released1);
|
|
470
|
+
EXPECT_EQ(taken1, taken0 + 1);
|
|
471
|
+
EXPECT_EQ(released1, released0 + 1)
|
|
472
|
+
<< "oversized span was parked or freed via libc instead of munmap";
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
TEST(ArenaDirectSpans, StandDownUnderCustomAllocator) {
|
|
476
|
+
#if defined(ARENA_TESTS_ASAN)
|
|
477
|
+
GTEST_SKIP() << "direct spans disabled under ASAN";
|
|
478
|
+
#endif
|
|
479
|
+
if (!leptris_arena_has_direct_spans())
|
|
480
|
+
GTEST_SKIP() << "platform has no anonymous-mmap span path";
|
|
481
|
+
leptris_arena_retain_drain();
|
|
482
|
+
leptris_set_memory_management_functions(
|
|
483
|
+
recycle_counting_alloc, recycle_counting_free);
|
|
484
|
+
g_recycle_allocs = 0;
|
|
485
|
+
g_recycle_frees = 0;
|
|
486
|
+
size_t taken0 = 0, released0 = 0;
|
|
487
|
+
leptris_arena_span_stats(&taken0, &released0);
|
|
488
|
+
|
|
489
|
+
LeptrisArena* a = leptris_arena_create(128u * 1024u * 1024u);
|
|
490
|
+
ASSERT_NE(a, nullptr);
|
|
491
|
+
leptris_arena_destroy(a);
|
|
492
|
+
|
|
493
|
+
size_t taken1 = 0, released1 = 0;
|
|
494
|
+
leptris_arena_span_stats(&taken1, &released1);
|
|
495
|
+
/* Hooked accounting must see the whole cycle — no direct lane. */
|
|
496
|
+
EXPECT_EQ(taken1, taken0);
|
|
497
|
+
EXPECT_EQ(released1, released0);
|
|
498
|
+
EXPECT_EQ(g_recycle_allocs, 1);
|
|
499
|
+
EXPECT_EQ(g_recycle_frees, 1);
|
|
500
|
+
|
|
501
|
+
leptris_arena_retain_drain();
|
|
502
|
+
leptris_set_memory_management_functions(NULL, NULL);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
TEST(ArenaDirectSpans, WithinBudgetSpanNeverGoesDirect) {
|
|
506
|
+
#if defined(ARENA_TESTS_ASAN)
|
|
507
|
+
GTEST_SKIP() << "retain cache disabled under ASAN";
|
|
508
|
+
#endif
|
|
509
|
+
if (!leptris_arena_has_direct_spans())
|
|
510
|
+
GTEST_SKIP() << "platform has no anonymous-mmap span path";
|
|
511
|
+
leptris_arena_retain_drain();
|
|
512
|
+
size_t taken0 = 0, released0 = 0;
|
|
513
|
+
leptris_arena_span_stats(&taken0, &released0);
|
|
514
|
+
|
|
515
|
+
LeptrisArena* a = leptris_arena_create(1u * 1024u * 1024u);
|
|
516
|
+
ASSERT_NE(a, nullptr);
|
|
517
|
+
leptris_arena_destroy(a);
|
|
518
|
+
|
|
519
|
+
size_t taken1 = 0, released1 = 0;
|
|
520
|
+
leptris_arena_span_stats(&taken1, &released1);
|
|
521
|
+
/* Retain-budget spans keep the park-and-reuse lane: the repeated
|
|
522
|
+
* parse fault fix depends on it. */
|
|
523
|
+
EXPECT_EQ(taken1, taken0);
|
|
524
|
+
EXPECT_EQ(released1, released0);
|
|
525
|
+
leptris_arena_retain_drain();
|
|
526
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
|
3
3
|
"name": "leptris",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.407",
|
|
5
5
|
"description": "High-performance XML parser and XPath 1.0 engine in C (libleptris)",
|
|
6
6
|
"homepage": "https://github.com/leptris/leptris",
|
|
7
7
|
"license": "MIT",
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: leptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.407.0
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|