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

fix memory corruption when using standalone heap #1478

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

zerbina
Copy link
Collaborator

@zerbina zerbina commented Dec 20, 2024

Summary

Fix using the standalone heap (enabled with --os:standalone or
-d:StandaloneHeapSize) resulting in memory corruption due to
incorrect page alignment.

Details

The initial pointer for the array-based page allocator is now aligned
to the size of a page, which ensures that osAllocPages always returns
a page-aligned pointer (the default allocator relies on this to be the
case).

A test is added to ensure that simple allocation/deallocation works
when using the array-based page allocator.

Summary
=======

Fix using the standalone heap (enabled with `--os:standalone` or
`-d:StandaloneHeapSize`) resulting in memory corruption due to
incorrect page alignment.

Details
=======

The initial pointer for the array-based page allocator is now aligned
to the size of a page, which ensures that `osAllocPages` always returns
a page-aligned pointer (the default allocator relies on this to be the
case).

A test is added to ensure that simple allocation/deallocation works
when using the array-based page allocator.
@zerbina zerbina added the bug Something isn't working label Dec 20, 2024
@saem
Copy link
Collaborator

saem commented Dec 20, 2024

/merge

Copy link

Merge requested by: @saem

Contents after the first section break of the PR description has been removed and preserved below:


@chore-runner chore-runner bot enabled auto-merge December 20, 2024 21:16
@chore-runner chore-runner bot added this pull request to the merge queue Dec 20, 2024
Merged via the queue into nim-works:devel with commit 2780633 Dec 20, 2024
37 checks passed
@zerbina zerbina deleted the fix-standalone-heap branch December 20, 2024 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants