-
Notifications
You must be signed in to change notification settings - Fork 118
Avoid unnecessary allocation from realloc #12
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
Conversation
|
Also, quick question: Should |
|
I'm not 100% convinced by this change. On the |
|
We could only copy if the size would lead to a different sizeclass? |
src/override/malloc.cc
Outdated
| "Calling realloc on pointer that is not to the start of an allocation"); | ||
| } | ||
| #endif | ||
| size_t sz = SNMALLOC_NAME_MANGLE(malloc_usable_size)(ptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call Alloc::alloc_size directly here, rather than the wrapper?
davidchisnall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Minor change would be nice, but I'm happy either way.
No description provided.