Re: Improving the memory allocator

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Improving the memory allocator
Date: 2011-04-26 11:59:45
Message-ID: 60216d868e5dc633d04f47203da50253@mail.softperience.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2011-04-26 12:15:09 Re: Proposal - asynchronous functions
Previous Message Yves Weißig 2011-04-26 09:18:09 Re: operator classes for index?