fix residual space in memory block

Started by Karel Zakabout 26 years ago5 messagespatches
Jump to latest
#1Karel Zak
zakkr@zf.jcu.cz

Here is the patch that create from residual space in memory block new free
chunks. We already discussed about it during 7.0. --- I owe this patch :-)

My previous implementation create _one_ chunk only. Now I implement it
in do{}while, and if residual space is large, it create more free chunks.
It is better for memory utilize.

For example in block is 112b (residual and in current code never used)

first new chunk 64 + 8 (header)
second new chunk 32 + 8 (header)

Tom, is it right?

Karel

#2Karel Zak
zakkr@zf.jcu.cz
In reply to: Karel Zak (#1)
(again) Re: fix residual space in memory block

Ops, I forget attache file :-) Here is it right.

Show quoted text

On Wed, 5 Jul 2000, Karel Zak wrote:

Here is the patch that create from residual space in memory block new free
chunks. We already discussed about it during 7.0. --- I owe this patch :-)

My previous implementation create _one_ chunk only. Now I implement it
in do{}while, and if residual space is large, it create more free chunks.
It is better for memory utilize.

For example in block is 112b (residual and in current code never used)

first new chunk 64 + 8 (header)
second new chunk 32 + 8 (header)

Tom, is it right?

Karel

Attachments:

aset-07052000.patch.gzapplication/x-gzip; name=aset-07052000.patch.gzDownload
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Karel Zak (#1)
Re: fix residual space in memory block

Karel Zak <zakkr@zf.jcu.cz> writes:

Here is the patch that create from residual space in memory block new free
chunks. We already discussed about it during 7.0. --- I owe this patch :-)

Right, I was going to ask you for that. Will apply it.

My previous implementation create _one_ chunk only. Now I implement it
in do{}while, and if residual space is large, it create more free chunks.

I think that is a waste of cycles. One chunk will get most of the
problem without much processing work...

regards, tom lane

#4Karel Zak
zakkr@zf.jcu.cz
In reply to: Tom Lane (#3)
Re: fix residual space in memory block

On Wed, 5 Jul 2000, Tom Lane wrote:

Karel Zak <zakkr@zf.jcu.cz> writes:

Here is the patch that create from residual space in memory block new free
chunks. We already discussed about it during 7.0. --- I owe this patch :-)

Right, I was going to ask you for that. Will apply it.

My previous implementation create _one_ chunk only. Now I implement it
in do{}while, and if residual space is large, it create more free chunks.

I think that is a waste of cycles. One chunk will get most of the
problem without much processing work...

I don't know how much spend time one or two cycle, but IMHO it is not
bad cost, because new block is not allocated very often (and in your new
in AllocSet it depend on context initialization) and if we implement it
without cycle we still have residual and never used space in memory. For
example if residual space will 400b new _one_ chunk reduce it to half
only...

We will see how much memory is residual in MemoryContextCheck() very
well (and you will see that I'm right :-)))

If I'm writing to you Tom --- do you want fill code in MemoryContextCheck()
yourself? --- or I can a little rewrite my function that I sent to you and
we can use it.

Thanks.
Karel

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Karel Zak (#4)
Re: Re: fix residual space in memory block

Karel Zak <zakkr@zf.jcu.cz> writes:

If I'm writing to you Tom --- do you want fill code in MemoryContextCheck()
yourself? --- or I can a little rewrite my function that I sent to you and
we can use it.

If you can do the rewrite I'd appreciate it --- I've got plenty of other
things to do...

regards, tom lane