Hacker News new | ask | show | jobs
by brenns10 3348 days ago
More important than any of the sibling arguments is that we're talking about a socket control block. I don't control where it is allocated or freed, so I can't dictate its location in memory.

Even if I did control it, there are probably several lists a socket might be a part of. Storing the socket in a dynamic array will only work for one of those lists. It's similar to a sparse database index - you can only have one of them. The rest of the lists have to be linked.

Not to mention, when items are shuffled around in a dynamic array, you lose the ability to have a consistent pointer to them.