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

Error in Malloc description #172

Open
skaftetryne opened this issue Oct 22, 2024 · 2 comments
Open

Error in Malloc description #172

skaftetryne opened this issue Oct 22, 2024 · 2 comments

Comments

@skaftetryne
Copy link

One should never rely on the number of bytes actually allocated corresponding to the number requested.

The number of bytes allocated is guaranteed to be the same (or more? I guess it's rounded up to the page size when MP is enabled?) as requested, Malloc will return null if not.

@mikrosk
Copy link
Member

mikrosk commented Oct 22, 2024

Yes, I guess that's the idea behind that phrasing. Do you think it needs rewording?

@skaftetryne
Copy link
Author

I think it should be removed, as it serves no other purpose than to confuse. Malloc is guaranteed to either return a pointer to a memory block of at least the requested size, or to fail. If the actual size of the block is larger than requested it does not matter - there is no way to know exactly how big it is. You only know that it's big enough.

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

No branches or pull requests

2 participants