Expose linear memory tracking APIs - #7
Merged
kmatasfp merged 11 commits intoAug 6, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Behavior
Store::linear_memorieswalks instantiated core memories and returns oneStoreMemoryfor each unique underlying backing. Memories do not need to be component exports to appear, and multiple imports, exports, or instance handles that alias the same backing are deduplicated. Callers can therefore reconcile a complete allocation total without relying on an export namedmemoryor enabling guest debugging.Unshared entries expose their current
data_sizethrough the store, while shared entries remain distinguishable for callers that need to reject or handle them separately. Pooled allocation preserves each memory'sMemoryKind, so shared and unshared backings are classified consistently across on-demand and pooled instances.For unshared memories, the resource limiter receives a committed-growth notification only after
memory.growhas succeeded and the new size is installed. Failed growth and pre-instantiation allocation do not emit the callback. This lets embedders update aggregate accounting from the exact committednew_size - old_sizedelta without treating an attempted growth as allocated memory.The fork does not add shared-memory growth observers or admission hooks. Shared backings remain enumerable only so embedders can identify them defensively; Golem disables WebAssembly threads/shared memory and rejects such components.