From 5d7e44fc8e855e3f15349876c48151018fa5d929 Mon Sep 17 00:00:00 2001 From: "Vadim B. Mikheev" Date: Thu, 21 Nov 1996 06:06:52 +0000 Subject: [PATCH] Fix memory overhelding while forming index' result: memory allocation for ItemPointerData of heap' tuple is useless because of FormRetrieveIndexResult makes neccessary palloc. --- src/backend/access/hash/hashsearch.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c index 654e04be592..459fbc3a167 100644 --- a/src/backend/access/hash/hashsearch.c +++ b/src/backend/access/hash/hashsearch.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.7 1996/11/05 09:40:23 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.8 1996/11/21 06:06:52 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -74,7 +74,6 @@ _hash_next(IndexScanDesc scan, ScanDirection dir) OffsetNumber offnum; RetrieveIndexResult res; ItemPointer current; - ItemPointer iptr; HashItem hitem; IndexTuple itup; HashScanOpaque so; @@ -116,9 +115,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir) _hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE); hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum)); itup = &hitem->hash_itup; - iptr = (ItemPointer) palloc(sizeof(ItemPointerData)); - memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData)); - res = FormRetrieveIndexResult(current, iptr); + res = FormRetrieveIndexResult(current, &(itup->t_tid)); return (res); } @@ -184,7 +181,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir) HashItem hitem; IndexTuple itup; ItemPointer current; - ItemPointer iptr; OffsetNumber offnum; RetrieveIndexResult res; HashScanOpaque so; @@ -245,9 +241,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir) _hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE); hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum)); itup = &hitem->hash_itup; - iptr = (ItemPointer) palloc(sizeof(ItemPointerData)); - memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData)); - res = FormRetrieveIndexResult(current, iptr); + res = FormRetrieveIndexResult(current, &(itup->t_tid)); return (res); } -- 2.39.5