Looks like resource leak: ./src/backend/storage/buffer/localbuf.c: LocalBufferDescriptors = (BufferDesc *) calloc(nbufs, sizeof(BufferDesc)); ./src/backend/storage/buffer/localbuf.c: LocalBufferBlockPointers = (Block *) calloc(nbufs, sizeof(Block)); ./src/backend/storage/buffer/localbuf.c: LocalRefCount = (int32 *) calloc(nbufs, sizeof(int32)); ./src/backend/storage/buffer/localbuf.c- if (!LocalBufferDescriptors || !LocalBufferBlockPointers || !LocalRefCount) ./src/backend/storage/buffer/localbuf.c- ereport(FATAL, ./src/backend/storage/buffer/localbuf.c- (errcode(ERRCODE_OUT_OF_MEMORY), ./src/backend/storage/buffer/localbuf.c- errmsg("out of memory"))); ./src/backend/storage/buffer/localbuf.c- ./src/interfaces/libpq/fe-print.c- nTups = PQntuples(res); ./src/interfaces/libpq/fe-print.c: if (!(fieldNames = (const char **) calloc(nFields, sizeof(char *)))) ./src/interfaces/libpq/fe-print.c- { ./src/interfaces/libpq/fe-print.c- fprintf(stderr, libpq_gettext("out of memory\n")); ./src/interfaces/libpq/fe-print.c- abort(); ./src/interfaces/libpq/fe-print.c- } ./src/interfaces/libpq/fe-print.c: if (!(fieldNotNum = (unsigned char *) calloc(nFields, 1))) ./src/interfaces/libpq/fe-print.c- { ./src/interfaces/libpq/fe-print.c- fprintf(stderr, libpq_gettext("out of memory\n")); ./src/interfaces/libpq/fe-print.c- abort(); ./src/interfaces/libpq/fe-print.c- } ./src/interfaces/libpq/fe-print.c: if (!(fieldMax = (int *) calloc(nFields, sizeof(int)))) ./src/interfaces/libpq/fe-print.c- { ./src/interfaces/libpq/fe-print.c- fprintf(stderr, libpq_gettext("out of memory\n")); ./src/interfaces/libpq/fe-print.c- abort(); ./src/interfaces/libpq/fe-print.c- } Two identical pieces of code: ./src/backend/bootstrap/bootstrap.c- scan = heap_beginscan_catalog(rel, 0, NULL); ./src/backend/bootstrap/bootstrap.c- i = 0; ./src/backend/bootstrap/bootstrap.c- while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL) ./src/backend/bootstrap/bootstrap.c- ++i; ./src/backend/bootstrap/bootstrap.c- heap_endscan(scan); ./src/backend/bootstrap/bootstrap.c: app = Typ = ALLOC(struct typmap *, i + 1); ./src/backend/bootstrap/bootstrap.c- while (i-- > 0) ./src/backend/bootstrap/bootstrap.c: *app++ = ALLOC(struct typmap, 1); ./src/backend/bootstrap/bootstrap.c- *app = NULL; ./src/backend/bootstrap/bootstrap.c- scan = heap_beginscan_catalog(rel, 0, NULL); ./src/backend/bootstrap/bootstrap.c- app = Typ; ./src/backend/bootstrap/bootstrap.c- while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL) ./src/backend/bootstrap/bootstrap.c- { ./src/backend/bootstrap/bootstrap.c- scan = heap_beginscan_catalog(rel, 0, NULL); ./src/backend/bootstrap/bootstrap.c- i = 0; ./src/backend/bootstrap/bootstrap.c- while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL) ./src/backend/bootstrap/bootstrap.c- ++i; ./src/backend/bootstrap/bootstrap.c- heap_endscan(scan); ./src/backend/bootstrap/bootstrap.c: app = Typ = ALLOC(struct typmap *, i + 1); ./src/backend/bootstrap/bootstrap.c- while (i-- > 0) ./src/backend/bootstrap/bootstrap.c: *app++ = ALLOC(struct typmap, 1); ./src/backend/bootstrap/bootstrap.c- *app = NULL; ./src/backend/bootstrap/bootstrap.c- scan = heap_beginscan_catalog(rel, 0, NULL); ./src/backend/bootstrap/bootstrap.c- app = Typ; ./src/backend/bootstrap/bootstrap.c- while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL) ./src/backend/bootstrap/bootstrap.c- {