Skip to content

Conversation

@marxin
Copy link
Contributor

@marxin marxin commented Dec 22, 2025

I verified the mmap mapping is preserved if memory.grow is called and so we don't re-create a new one.

Fixes: #5795

Copilot AI review requested due to automatic review settings December 22, 2025 06:00
@marxin marxin requested a review from syrusakbary as a code owner December 22, 2025 06:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #5795 where the memory size was not properly reported after calling memory.reset(). The fix ensures that the VMMemoryDefinition.current_length field is updated when resetting memory, making it consistent with how this field is updated during memory growth operations.

  • Updates the WasmMmap::reset() method to properly synchronize the memory definition with the internal size state
  • Adds a comprehensive test case that verifies memory size reporting after reset and subsequent grow operations

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/vm/src/memory.rs Updates the reset() method to set VMMemoryDefinition.current_length to 0, ensuring size consistency with the internal size field
tests/compilers/issues.rs Adds test case issue_5795_memory_reset_size to verify that memory size is correctly reported after reset and can be grown again from size 0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@marxin marxin enabled auto-merge (squash) December 23, 2025 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected Behavior of memory.reset in Wasmer

2 participants