Hacker News
points by 0c3ca83 4 days ago | 0 comments
There's no syscall on every allocation. With many allocators, the common case is popping a node off a linked list.
[–] fasterik 4 days ago
That's why I put the word "potential" in there. Every allocation potentially needs to go to the OS for more pages.
[–] 0c3ca83 4 days ago
And every memory access potentially enters the kernel via a page fault.
[–] cowlevel 3 days ago
Any given CPU instruction potentially isn't in cache.

And yet, they can't all not be in cache. As soon as the cache is accessed for one instruction, a bunch more are pulled in too.

Any given vector.push call could reallocate the vector, but it's amortized O(1).