[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: daily: vim problem again
From: |
Paul Dufresne |
Subject: |
Re: daily: vim problem again |
Date: |
Fri, 26 Feb 2021 21:38:20 -0500 |
User-agent: |
Zoho Mail |
Here is the relevant part in malloc.c:
/*
Search for a chunk by scanning bins, starting with next largest
bin. This search is strictly by best-fit; i.e., the smallest
(with ties going to approximately the least recently used) chunk
that fits is selected.
The bitmap avoids needing to check that most blocks are nonempty.
The particular case of skipping all bins during warm-up phases
when no chunks have been returned yet is faster than it might look.
*/
++idx;
bin = bin_at (av, idx);
block = idx2block (idx);
map = av->binmap[block];
bit = idx2bit (idx);
for (;; )
{
/* Skip rest of block if there are no more set bits in this block. */
if (bit > map || bit == 0)
{
do
{
if (++block >= BINMAPSIZE) /* out of bins */
goto use_top;
}
while ((map = av->binmap[block]) == 0);
bin = bin_at (av, (block << BINMAPSHIFT));
bit = 1;
}
/* Advance to bin with set bit. There must be one. */
while ((bit & map) == 0)
{
bin = next_bin (bin);
bit <<= 1;
assert (bit != 0);
}
/* Inspect the bin. It is likely to be non-empty */
victim = last (bin);
/* If a false alarm (empty bin), clear the bit. */
if (victim == bin)
{
av->binmap[block] = map &= ~bit; /* Write through */
bin = next_bin (bin);
bit <<= 1;
}
else
{
size = chunksize (victim);
/* We know the first chunk in this bin is big enough to use. */
assert ((unsigned long) (size) >= (unsigned long) (nb));
remainder_size = size - nb;
/* unlink */
unlink_chunk (av, victim);
- daily: vim problem again, Paul Dufresne, 2021/02/26
- Re: daily: vim problem again, Samuel Thibault, 2021/02/26
- Re: daily: vim problem again, Paul Dufresne, 2021/02/26
- Re: daily: vim problem again, Samuel Thibault, 2021/02/26
- Re: daily: vim problem again, Paul Dufresne, 2021/02/26
- Re: daily: vim problem again, Samuel Thibault, 2021/02/26
- Re: daily: vim problem again, Paul Dufresne, 2021/02/26
- Re: daily: vim problem again, Jessica Clarke, 2021/02/26
- Re: daily: vim problem again, Paul Dufresne, 2021/02/26
- Re: daily: vim problem again, Samuel Thibault, 2021/02/27
- Re: daily: vim problem again,
Paul Dufresne <=
- Re: daily: vim problem again, Jessica Clarke, 2021/02/26
- Re: daily: vim problem again, Paul Dufresne, 2021/02/26
- Re: daily: vim problem again Off Topic Praise, Joshua Branson, 2021/02/27
- Re: daily: vim problem again Off Topic Praise, Samuel Thibault, 2021/02/27
- Re: daily: vim problem again, Paul Dufresne, 2021/02/28
- Re: daily: vim problem again, Samuel Thibault, 2021/02/28