[PATCH] D63668: [Support] Improve zero-size allocation with safe_malloc, etc.
Alex Brachet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 24 09:56:51 PDT 2019
abrachet added a comment.
> What is known is that there is existing client code that would need additional changes should the assertion be added.
Agreed. it's just that malloc(0 /* -> 1 */) is expensive in that it fragments the memory pool for no good reason (there is a case that this doesn't matter because all llvm tools are short lived programs, but I don't think that's a reason to ignore fragmentation). It would be better design if the clients calling safe_* took steps to not do this even if the C standard allows it, in my opinion.
There are of course reasons to not go this way as you two have pointed out, sorry for all the noise.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63668/new/
https://reviews.llvm.org/D63668
More information about the llvm-commits
mailing list