"Neil Conway" <[EMAIL PROTECTED]>writes
> Well, element_alloc() uses the hash table's alloc function pointer. In
> theory, that could be malloc() or anything else, although I notice this
> abstraction is not consistently maintained (e.g. dir_realloc assumes
> pfree() is sufficient to free an allocation).

Yes, in theory it could do so. But in fact element_alloc() uses
DynaHashAlloc() for ordinary hash table or uses ShmemAlloc() for shared
memory case. The problem is that both of these could elog(ERROR) themselves.

> I think it would be a good idea to change dynahash.c to assume that the
> hash table's allocation function will elog(ERROR) on out-of-memory,

DynaHashAlloc() looks like this. ShmemAlloc() just elog(WARNING), we could
revise it ... but if you do so, how to rewrite

if (!hash_search(HASH_ENTER))    /* for example: RememberFsyncRequest() */

Use critical_section?


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?


Reply via email to