Wasmex.Memory.length

You're seeing just the function length, go back to Wasmex.Memory module for more information.

Specs

length(t()) :: pos_integer()

Returns the number of elements that fit into memory for the given unit size and offset.

Note that the WebAssembly memory consists of pages of 65kb each. Different unit sizes needs a different number of bytes per element and the offset may reduce the number of available elements.

{:ok, memory} = Wasmex.Memory.from_instance(instance, :uint8, 0)
Wasmex.Memory.length(memory) # 1114112 (17 * 65_536)
Link to this function

length(memory, size, offset)

Specs

length(t(), atom(), non_neg_integer()) :: pos_integer()

Same as length/1 except the unit size and offset given at memory creation are overwritten by the given values.

{:ok, memory} = Wasmex.Instance.memory(instance)
Wasmex.Memory.length(memory, :uint8, 0) # 1114112 (17 * 65_536)