objectpool
objectpool copied to clipboard
the realloc may change pointer
you use realloc to add block ,but realloc may return a pointer different from the previous, if this happen, all the allocated object pointer will be invalid. this is a serious issue. so i advise not to use realloc, but alloc a new chunk, then use lists to connect the chunks.
It's been a while since I looked at this code. But from what I can see the only places that realloc reassign the pointer and I don't believe anything points to memory inside this block, so nothing should end up dangling if the buffer moves in memory.
Have you hit a specific bug with this code?