I didn't followed this topic carefully, so sorry If I wrote something that was written, but I thought about following approach at least for message sending, etc.:

1. When initializing MemoryContext (pool) give one parameter that will be stack size. Stack is addition to normal operations. 2. Operations on stack are only allocations, so alloc will be just pointer bump. 3. When allocating memory for messages, internally set size to be 1/3 greater (or 2/3 I don't remember well) for realloc, may help when encoding change occurs. 3. free is no op (as it was pointed), stack will be released or pointer resetted, when context is released

From one point of view this may waste some memory (no free), but for messages should not happen, and even giving 100kb of memory for stack may be quite enough, depending ofcourse how many data you send.

Regards,
Radek

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to