-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
memory fixes for windows #138
Conversation
@@ -103,7 +95,7 @@ impl Memory { | |||
impl Drop for Memory { | |||
fn drop(&mut self) { | |||
if !self.ptr.is_null() { | |||
let success = unsafe { libc::munmap(self.ptr as _, self.size) }; | |||
let success = unsafe { VirtualFree(self.ptr as _, self.size, MEM_DECOMMIT) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the winapi equivalent of munmap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
||
if ptr.is_null() { | ||
Err("unable to allocate memory") | ||
Err(String::from("unable to allocate memory")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer .to_string
here, but it doesn't matter much.
…-from-env doc(wasi) Fix documentation of `generate_import_object_from_env`
This PR fixes a few small issues with building memory code for windows. We use the winapi
VirtualFree
instead ofmunmap
. A few crates were added that had been missing from the wasmer runtime crate.