jeffcharles opened issue #12284:
Test Case
Any Wasm module.
Steps to Reproduce
let engine = Engine::default(); let module = Module::from_file(&engine, "testcase.wasm").unwrap(); let range = module.image_range(); let offset = unsafe { range.end.offset_from(range.start) }; println!("Offset is {offset}");Expected Results
The documentation for the method says:
Returns the range of bytes in memory where this module’s compilation image resides.
The compilation image for a module contains executable code, data, debug information, etc. This is roughly the same as the Module::serialize but not the exact same.
I was expecting the range to contain the bytes that contain all of the compilation image.
Actual Results
The range contains the bytes for the executable code but no longer includes data, debug information, or any other parts of the compilation image.
The source code for the method appears to only retrieve the text section.
Versions and Environment
Wasmtime version or commit: Wasmtime 40.0.0
Operating system: All
Architecture: All
Extra Info
We're using the
image_sizeAPI in wasmtime-rb to inform the Ruby garbage collector about the size of the memory used for the anonymous mmap when creating a module.It looks like the change in implementation was introduced here on line 975.
jeffcharles added the bug label to Issue #12284.
alexcrichton commented on issue #12284:
Thanks for the report and for the bisection! cc @cfallin when you get back would you be willing to take a look at this?
cfallin commented on issue #12284:
Yep, just sent a PR -- sorry and thanks for the heads-up!
cfallin closed issue #12284:
Test Case
Any Wasm module.
Steps to Reproduce
let engine = Engine::default(); let module = Module::from_file(&engine, "testcase.wasm").unwrap(); let range = module.image_range(); let offset = unsafe { range.end.offset_from(range.start) }; println!("Offset is {offset}");Expected Results
The documentation for the method says:
Returns the range of bytes in memory where this module’s compilation image resides.
The compilation image for a module contains executable code, data, debug information, etc. This is roughly the same as the Module::serialize but not the exact same.
I was expecting the range to contain the bytes that contain all of the compilation image.
Actual Results
The range contains the bytes for the executable code but no longer includes data, debug information, or any other parts of the compilation image.
The source code for the method appears to only retrieve the text section.
Versions and Environment
Wasmtime version or commit: Wasmtime 40.0.0
Operating system: All
Architecture: All
Extra Info
We're using the
image_sizeAPI in wasmtime-rb to inform the Ruby garbage collector about the size of the memory used for the anonymous mmap when creating a module.It looks like the change in implementation was introduced here on line 975.
alexcrichton commented on issue #12284:
@jeffcharles would you be ok waiting for the 41.0.0 release in ~11 days, or would you prefer a 40.0.2 release with this fix?
jeffcharles commented on issue #12284:
I'm okay with waiting. We don't have anyone pressing us for the version 40 release of wasmtime-rb at the moment so we can probably just wait and cut a release for version 41.
Last updated: Feb 24 2026 at 06:21 UTC