Re: pg_upgrade: out of memory

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pg_upgrade: out of memory
Дата
Msg-id 22609.1349098761@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pg_upgrade: out of memory  ("Carrington, Matthew (Produban)" <Matthew.Carrington@Produban.co.uk>)
Ответы Re: pg_upgrade: out of memory  ("Carrington, Matthew (Produban)" <Matthew.Carrington@Produban.co.uk>)
Re: pg_upgrade: out of memory  ("Carrington, Matthew (Produban)" <Matthew.Carrington@Produban.co.uk>)
Список pgsql-general
"Carrington, Matthew (Produban)" <Matthew.Carrington@produban.co.uk> writes:
> pg_dump: reading user-defined aggregate functions

> Breakpoint 1, exit_horribly (modulename=0x0, fmt=0x10006a590 "out of memory\n")
>     at dumputils.c:1314
> 1314    dumputils.c: A file or directory in the path name does not exist..
> (gdb) bt
> #0  exit_horribly (modulename=0x0, fmt=0x10006a590 "out of memory\n") at dumputils.c:1314
> #1  0x000000010003247c in pg_malloc (size=0) at dumpmem.c:47
> #2  0x0000000100008f54 in getAggregates (fout=0x11000bad0, numAggs=0xffffffffffff73c)
>     at pg_dump.c:3614

Oh!  Given your previous comment about there not being any user-defined
aggregates, I see what the problem is.  AIX must be one of the platforms
where malloc(0) is defined to return NULL rather than a pointer to a
zero-size block.  pg_malloc is not coping with that.

A quick fix would be

pg_malloc(size_t size)
{
    void       *tmp;

    tmp = malloc(size);
-    if (!tmp)
+    if (!tmp && size)
    {
        psql_error("out of memory\n");
        exit(EXIT_FAILURE);
    }

but I'm not sure if that's the best answer overall.  Will take it up in
-hackers.

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Moshe Jacobson
Дата:
Сообщение: What's faster? BEGIN ... EXCEPTION or CREATE TEMP TABLE IF NOT EXISTS?
Следующее
От: Marco Craveiro
Дата:
Сообщение: Postgres error when adding new page