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

Fixed allocating buffers above 2GB. #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

knockshore
Copy link

Although the maximum length for buffer is 4GB
check buffer.constants.MAX_LENGTH
Added hint on initializing the context after creating the context.

Thanks
Karthick

Although the maximum length for buffer is 4GB
check buffer.constants.MAX_LENGTH
Added hint on initializing the context after creating the context.
@scriptorian
Copy link
Contributor

I'm a bit confused. The original code doesn't look quite right but I'm not sure exactly what you are trying to achieve. While it seems unlikely to be used in the workflows I'm familiar with the underlying allocations support a buffer size specified as a 64-bit integer. If I were to make a change here I would look to read the JS number into a 64-bit value and pass it through to the allocation. This pull request allows a slightly larger buffer size to be passed in but it gets assigned to a 32-bit value just below. Comments?

@knockshore
Copy link
Author

knockshore commented Oct 14, 2021

Problem is when allocating buffer above 2GB, the createBuffer fails and says that the buffer size cannot be (edit: negative). So, I thought this would help in future.
I tried to run a blockchain miner (Ethereum Classic) kernel using the nodencl library.
I understand above 2GB allocation requires more changes like when releasing the buffers, the messages shows in negative values and considering converting the Number/BigInt type to int64.
I'll write a test spec for this later, may be I'll add another pull request.

Thanks
Karthick

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.

2 participants