memory: bug or feature

Started by Karel Zakover 25 years ago2 messages
#1Karel Zak
zakkr@zf.jcu.cz

I'm playing with MemoryContextCheck() and I a little confuse now.

How idea is for:

context->initBlockSize
context->maxBlockSize

Must be a memory block already between this range? For example
the AllocSetAlloc() if create a single-chunk-block not check it and create
block less than 8*1024 (an example for CacheMemoryContext).

The AllocSetRealloc() not check it too.

Karel

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Karel Zak (#1)
Re: memory: bug or feature

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

I'm playing with MemoryContextCheck() and I a little confuse now.
How idea is for:
context->initBlockSize
context->maxBlockSize

Must be a memory block already between this range?

No, those are just hints for allocation of default-sized blocks. They
don't constrain allocation of blocks that have to be a particular size
to accommodate a large chunk. The reason for having them is just to
allow a caller who expects that a particular context won't contain much
data to prevent a lot of wasted space from being allocated for big
default-sized blocks.

regards, tom lane