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!
Last updated: Jan 09 2026 at 13:15 UTC