Skip to content
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

Merged
merged 3 commits into from
Feb 6, 2019
Merged

memory fixes for windows #138

merged 3 commits into from
Feb 6, 2019

Conversation

xmclark
Copy link
Contributor

@xmclark xmclark commented Feb 5, 2019

This PR fixes a few small issues with building memory code for windows. We use the winapi VirtualFree instead of munmap. A few crates were added that had been missing from the wasmer runtime crate.

@@ -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) };
Copy link
Contributor Author

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

Copy link
Contributor

@lachlansneff lachlansneff left a 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"))
Copy link
Contributor

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.

@xmclark xmclark merged commit 7bd609f into master Feb 6, 2019
@xmclark xmclark deleted the fix/small-memory-fixes-windows branch February 6, 2019 00:07
nlewycky pushed a commit that referenced this pull request Aug 13, 2020
…-from-env

doc(wasi) Fix documentation of `generate_import_object_from_env`
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.

3 participants