Neil Conway <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> That test is a no-op in the case where hashp->alloc in fact points to
>> palloc.  But it doesn't always point there --- see shmem_alloc.

> Perhaps it would be a net win to change ShmemAlloc() to elog(ERROR) on 
> out-of-memory?

Possibly.  I haven't looked through the call sites to make an estimate
on whether this would be worthwhile or not.  One thing you'd have to
look at carefully is whether any of the call sites are inside critical
sections --- if so, an elog(ERROR) inside ShmemAlloc would become
elog(PANIC), which might be more severe than is warranted.

> A fair few of the ShmemAlloc() call sites don't bother to 
> check the return value anyway,

Really?   But it wouldn't surprise me that much --- the vast majority of
the individual calls are during postmaster initialization, and could not
possibly fail unless the initial-shmem-space-request calculation is
wrong.  The only case that can actually fail on-the-fly is allocation of
a new entry in a shared-memory hash table, and we know that case is

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to