Could the large allocation[2] for the dead tuple array in lazy_space_alloc cause problems with linux OOM? [1] and some other things I've read indicate that a large mmap will count towards total system memory, including producing a failure if overcommit is disabled.

Would it be worth avoiding the full size allocation when we can?

If we did this, I think allocate reltuples * autovacuum_vacuum_threshold slots initially, and then growing the array if needed.


In lazy_space_alloc() we will palloc the dead tuple array to be as large as maintenance_work_mem, with the only limit being that we won't make it larger than the maximum possible number of tuples in the relation.

My understanding is that this doesn't suck only because palloc passes such a large allocation direct to malloc, which in turn uses mmap, which won't actually allocate the memory until we access it.
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble!

Sent via pgsql-hackers mailing list (
To make changes to your subscription:

Reply via email to