Closed singpolyma-shopify closed 8 years ago
dlmalloc will actually do a tiny chunk allocation in that case... i.e. 0
doesn't mean no op
dlmalloc will actually do a tiny chunk allocation in that case... i.e. 0 doesn't mean no op
I that case should we return sizeof(void *)
bytes?
nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
Where MIN_CHUNK_SIZE
== ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
... and there I stopped resolving macros... but did I read this wrong?
Ah yeah that makes sense.
Previously, if we were asked to free (size == 0) a NULL pointer (we observe mruby trying to do this in our tests) we would try to allocate with size of 0.
Instead we should simply report free success to the caller and do nothing.