RTempStringAlloc class final
A specialised slot-based allocator for C strings (Pointer\<Char>).
Maintains two separate pools:
- Anonymous slots – a ring buffer of slotCount slots, cycled through via Value without a key. Useful for transient strings within a single frame.
- Keyed slots – named slots allocated on demand via ValueAt and
Array, persisting until explicitly freed or
_disposeis called.
String memory is managed with malloc and is grown in-place when the
encoded UTF-8 length of a new string exceeds the current slot capacity,
avoiding unnecessary reallocations for strings of similar length.
- Inheritance
-
- Object
- RTempAlloc<
Pointer< Char> > - RTempStringAlloc
Constructors
Properties
-
allocatorFunc
↔ Pointer<
Pointer< Function([int count])Char> > -
Low-level allocation function. Called with an element
countand returns a freshly allocatedPointer<T>.getter/setter pairinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
Human-readable name for this allocator, used in debug/log messages.
finalinherited
-
printerFunc
↔ String Function(Pointer<
Pointer< ptr)Char> > -
Debug printer: converts a
Pointer<T>to a human-readable string.getter/setter pairinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- slotCount → int
-
Number of anonymous (ring-buffer) string slots pre-reserved on construction.
final
Methods
-
Array(
List< String> array, {String? key}) → Pointer<Pointer< Char> > -
Writes each string in
arrayinto keyed sub-slots and returns a trackedPointer<Pointer<Char>>of lengtharray.length. -
At(
String key, [int count = 1]) → Pointer< Pointer< Char> > -
Returns the
Pointer<T>stored inkey, allocating (or reallocating) if necessary.inherited -
Fill(
int count, Pointer< Char> init(int), {String? key}) → Pointer<Pointer< Char> > -
Fills a tracked Pointer<Pointer<Char>> of
countelements by calling init for each index. -
Free(
String key) → void -
Frees the native memory owned by slot
keyand removes it from the table.override -
Has(
String key) → bool -
Returns
trueif a slot with the givenkeyexists.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
Raw(
[int count = 1]) → Pointer< Pointer< Char> > -
Allocates and returns an unslotted array of
countPointer<Char>pointers. -
signature(
) → String -
Returns a string that identifies the concrete type of this allocator,
including its type parameters (e.g.
"RTempAlloc<Float>").inherited -
Slot(
String key) → Pointer< Pointer< ?Char> > -
Returns the pointer stored under
key, ornullif the slot does not exist. Does not allocate.inherited -
toString(
) → String -
A string representation of this object.
inherited
-
Unslot(
String key) → void -
Removes the slot entry for
keyfrom the table without freeing the underlying memory.inherited -
Value(
String text, [String? key]) → Pointer< Char> -
Returns a
Pointer<Char>fortextusing the next anonymous ring-buffer slot. -
ValueAt(
String key, [String? text]) → Pointer< Char> -
Returns the
Pointer<Char>for the keyed slotkey, optionally writingtextinto it.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited