3 ms·
That is the reason you check the freelist in the unlikely case that you see it, the cost would average to near nothing except for the memory accesses to set, ch
by josefx 7y ago
That is the reason you check the freelist in the unlikely case that you see it, the cost would average to near nothing except for the memory accesses to set, check and clear the value.
You could also xor the memory location into the marker to avoid multiple collisions for applications that allocate a large amount of similar objects.
- laughinghan 7y agoBesides, what's the minimum chunk size? Can't be less than the 64-bit word size can it? The chances of a random 8-byte gravestone appearing in legit memory is practically nil. If free() took only 1ns to run and you called it 2^64 times, that would take >500 years.