2 ms·
It's just pointer bumping (still). If you're continously using new memory then soft page faults and finding physical backing via kernel will dominate. mallocsen
by the-smug-one 3y ago
It's just pointer bumping (still). If you're continously using new memory then soft page faults and finding physical backing via kernel will dominate. mallocsen want to avoid this scenario, so you often see malloc using more memory than necessary.
Anyway, don't use new in C++ is my opinion.
- pkolaczk 3y agoIt's pointer bumping in optimistic case. Eventually it runs out of current slab and... then there is some more work to do. And also those page faults are actually quite likely as it gives you memory that hasn't been used recently. Malloc tends to return often whatever was released last that matches the requested allocation size. It is indeed a tad more work to find it, but when it's found it's usually hot in the cache.