-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Why need extra 5 bytes for buf? #255
Comments
Good question, I should have documented this better back when I did it. The commit that changed this comment was made in pull request #146, before that it was more than that, because back then it wasn't possible to know beforehand, how much space was needed for numbers. Now that numbers are first parsed into a buffer and then copied over, this problem doesn't exist anymore, therefore the change to 5. But I have to investigate further, where the 5 comes from, I think it had something to do with UTF-16 |
I currently can't find any reason why. Needs some more investigation, maybe I can drop these + 5, I think they could have been just "to be safe". |
It definitely was "just to be safe". I haven't had the time yet to review all the codepaths thoroughly enough to ensure that the required memory isn't still overestimated (by a smaller margin) somewhere. |
I seem to have found the reason for the inaccurate memory estimate. Please take a look at #283 |
in test.c line 56:/* the extra 5 bytes are because of inaccuracies when reserving memory */
why the the extra 5 bytes ? It is like a magic number.
what reason cause inaccuracies when reserving memory?
The text was updated successfully, but these errors were encountered: