storageSize (schema -- size)
Inputs
schema: Object orRefwhose dereferenced schema determines the reported storage size.
Outputs
Ref inputs are followed before the query. Current value contents, current value state, and current view qualifiers do not participate.
Behavior
- Code and Text targets are invalid.
- Known issue: the result is too small for a non-Meta uniform Dict that holds a static field and can be too small for an object that contains one.
Example: 1nx views and a 2nx Dict
Every view of a Nat8 has storage size 1nx, and a Dict of two Nat8 fields has size 2nx but alignment 1nx.
{} 0 {} [
value: 0n8 dynamic;
pair: { left: 0n8; right: 0n8; };
"-- same schema, same result --" printCompilerMessage
0n8 storageSize printStack _:;
value storageSize printStack _:;
@value storageSize printStack _:;
"-- size versus alignment --" printCompilerMessage
pair storageSize printStack _:;
pair alignment printStack _:;
0
] "main" exportFunction
Expected Output During Compilation
-- same schema, same result --
1nx
1nx
1nx
-- size versus alignment --
2nx
1nx
See also
addressToReferencebuiltin(address modelValue -- reconstructedValue)Typed reconstruction from a numeric storage address. Ref-like model objects keep their schema, and direct non-Ref-like model objects produceRefresults.alignmentbuiltin(schema -- alignment)KnownNatxalignment requirement of the dereferenced schema.manuallyDestroyVariablebuiltin(object --)Manual in-place destruction without freeing storage.manuallyInitVariablebuiltin(object --)Manual initialization in existing storage.storageAddressbuiltin(object -- address)Current stack-object storage-address query; knownNILRef,Text, andCodeobjects yield0nx.