From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Carrington, Matthew (Produban)" <Matthew(dot)Carrington(at)produban(dot)co(dot)uk> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: pg_upgrade: out of memory |
Date: | 2012-10-01 13:39:21 |
Message-ID: | 22609.1349098761@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Carrington, Matthew (Produban)" <Matthew(dot)Carrington(at)produban(dot)co(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Marco Craveiro | 2012-10-01 13:47:17 | Postgres error when adding new page |
Previous Message | Moshe Jacobson | 2012-10-01 13:36:13 | What's faster? BEGIN ... EXCEPTION or CREATE TEMP TABLE IF NOT EXISTS? |