Re: realloc overhead (was Multiple sorts in a query)

Поиск
Список
Период
Сортировка
От pg@thetdh.com
Тема Re: realloc overhead (was Multiple sorts in a query)
Дата
Msg-id W257492060821931242827453@webmail36
обсуждение исходный текст
Список pgsql-hackers
>>> So at least transiently we use 3x the size of the actual array.
>> I was conjecturing, prior to investigation. Are you saying you know this/have seen this already?
> Well I'm just saying if you realloc a x kilobyte block into a 2x block and the allocator can't expand it and has to copy then it seems inevitable.
FYI the malloc()/realloc()/free() on FC4 causes memory fragmentation, and thus a long-term growth in process memory, under some circumstances. ?This, together with the power-of-two allocations in aset.c not accounting for malloc() overhead (not that they could), implies that memory contexts can cause fragmentation, more slowly, too.
Reallocations of smallish blocks from memory contexts tend to use memory already withheld from the OS; a transient increase in memory usage is possible, but unlikely to matter. ?Perhaps something should be done about larger blocks.
David Hudson

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Compiler warning
Следующее
От: Tobias Zahn
Дата:
Сообщение: Re: GEQO: ERX