I have added this to the TODO list:
* improve dynamic memory allocation by introducing tuple-context memory allocation
* add pooled memory allocation where allocations are freed only as a group
> We could use 4 methods for dynamic allocation:
>
> 1) malloc/free - for persistent storage allocation
>
> 2) palloc/pfree - for storage belonging to some context and
> which we can keep track of and free explicitly
>
> 3) fast_palloc - for storage which impossible, too difficult or too
> expensive to keep track of. This storage should be allocated with
> fast and simple inline code from bigger chunks allocated with palloc.
> This storage would never freed explicitly, so that code could be
> simple and fast, but the big chunks would be freed automatically at
> the end of the transaction.
>
> 4) fast_talloc - we could introduce a `tuple' context handled like
> fast_palloc for storage used only while processing one tuple.
> This storage could be fast allocated from few big chunks allocated
> with palloc and freed explicitly after the tuple has been processed.
> This could avoid the overhead of many malloc/palloc while reducing
> the overall memory usage for transaction which process many rows.
> The total cost per tuple could be one palloc and one pfree.
> We could also simply reuse the chunks for every tuple and pfree them
> only at the end of the transaction. This would cost one palloc/pfree
> per transaction.
>
> This would require revising the code and changing palloc/pfree with the new
> functions where appropriate, but this could be done gradually because the
> old palloc/pfree are always safe.
>
> --
> Massimo Dal Zotto
>
> +----------------------------------------------------------------------+
> | Massimo Dal Zotto email: dz@cs.unitn.it |
> | Via Marconi, 141 phone: ++39-0461534251 |
> | 38057 Pergine Valsugana (TN) www: http://www.cs.unitn.it/~dz/ |
> | Italy pgp: finger dz@tango.cs.unitn.it |
> +----------------------------------------------------------------------+
>
>
-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610)
853-3000+ If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill,
Pennsylvania19026