Re: Interesting misbehavior of repalloc()

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: Interesting misbehavior of repalloc()
Дата
Msg-id 20070811193055.GC4960@tamriel.snowman.net
обсуждение исходный текст
Ответ на Interesting misbehavior of repalloc()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Interesting misbehavior of repalloc()
Список pgsql-hackers
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
[...]
> 3. When regexp_matches is done with the current call, it politely
> releases the chunk, and AllocSetFree sticks it into the freelist for
> 4K chunks.
>
> 4. The next call of regexp_matches asks for a 2K chunk.  There's nothing
> in the 2K chunk freelist, so AllocSetAlloc allocates a new chunk from
> the end of the context's current memory block.
>
> Lather, rinse, repeat --- each cycle adds another entry to the 4K-chunk
> freelist, which we'll never use.

This is likely to be naive, but perhaps it'll help others understand
too.  Would it be sensible to look at trying to fill a 2K request from
the next-larger (4K-chunk) freelist before allocating a new chunk?
Could it, essentially, "downgrade" the 4K chunk into 2 2K chunks when
that's what is being asked for (and the 2K freelist is empty, and the 4K
freelist isn't, etc)?

The realloc-in-place seems like a good idea in general, but this test
case does need to be handled in some clean way.  Perhaps allowing a
"downgrade" path along with the "upgrade" path would work well.

(If that's what you were suggesting already, then sorry for the noise)
Thanks,
    Stephen

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: pgcheck - data integrity check
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: 2D partitioning of VLDB - sane or not?