(no title)
seiji | 10 years ago
So many programmers don't even consider "overhead" of data when writing things. But, most of the time it doesn't matter. Do you need a list of ten things? Great. Do whatever. Do you need a list of a billion things? Then you need to rethink everything from the bottom up.
when all you need is just a pointer to realloc
Wrong! https://github.com/Tarsnap/libcperciva/commit/cabe5fca76f6c3...
catnaroek|10 years ago
Because they're using managed languages where the amount of overhead per object can't be reduced to zero. And also because, in exchange for that overhead, they get other benefits, like compacting garbage collection. But you don't get this in C.
eps|10 years ago
No, of course not "Wrong!"
If a user of a library wants to supply their own allocator, they must provide a version of realloc that acts as free() for the (p,0) case. That's the semantics the library expects, observe them. Internally the lib may look at whether a custom realloc is set, and fallback to malloc/free if it's not.
unknown|10 years ago
[deleted]