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

Do not attempt to allocate >= 4 GiB on 32-bit systems #99

Merged
merged 1 commit into from Jul 9, 2019

Conversation

@tevador
Copy link
Owner

commented Jul 3, 2019

  • Cache size limited to 2 GiB
@@ -102,6 +103,12 @@ extern "C" {
}

randomx_dataset *randomx_alloc_dataset(randomx_flags flags) {

//fail on 32-bit systems if DatasetSize is >= 4 GiB

This comment has been minimized.

Copy link
@hyc

hyc Jul 3, 2019

Contributor

Shouldn't the failure threshold be much smaller? At 4GiB there is no room in the address space for any other code or data.

This comment has been minimized.

Copy link
@tevador

tevador Jul 3, 2019

Author Owner

If the computer doesn't have enough virtual memory (which is likely) then the allocation will fail naturally.

This condition is in place to prevent an overflow which could make the allocation to falsely succeed. For example if DatasetSize is 4.5 GiB, it will overflow to 0.5 GiB on 32-bit systems and only 0.5 GiB will be allocated, leading to runtime crashes.

This comment has been minimized.

Copy link
@hyc

hyc Jul 3, 2019

Contributor

ok

@hyc

hyc approved these changes Jul 3, 2019

@tevador tevador merged commit 47ade5e into master Jul 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.