2 ms·
> Something else people often don't realize is that malloc/free aren't instant. True, and the costs vary wildly and are deeply tied into the rest of the memory
by munificent 5y ago
> Something else people often don't realize is that malloc/free aren't instant.
True, and the costs vary wildly and are deeply tied into the rest of the memory management strategy.
In a copying collector, free() is essentially free: It takes the same amount of time to free 1 object in the semispace as it does 1,000 objects in the same semispace.