safer behavior for goodMallocSize on very large minSize
Summary: Currently malloc(goodMallocSize(x)) will succeed when x is larger than the maximum possible allocation supported by jemalloc. This is not desirable. Currently goodMallocSize(x) returns 0 if x is too large, but 0 is a valid argument for malloc and causes a 1 byte allocation. This diff causes goodMallocSize(x) to return x in that case, which will cause the subsequent malloc to fail. The caller may catch that failure or crash immediately, but those are both preferrable to returning a pointer to a valid 1-byte allocation. Reviewed By: al13n321 Differential Revision: D9778137 fbshipit-source-id: 3eb8da72d6240b28da85483f0d91653f5e04b333
Showing
Please register or sign in to comment