Commit 5d7e44fc authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

Fix memory overhelding while forming index' result:

memory allocation for ItemPointerData of heap' tuple is useless

because of FormRetrieveIndexResult makes neccessary palloc.
parent 05b3b861
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -74,7 +74,6 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
OffsetNumber offnum; OffsetNumber offnum;
RetrieveIndexResult res; RetrieveIndexResult res;
ItemPointer current; ItemPointer current;
ItemPointer iptr;
HashItem hitem; HashItem hitem;
IndexTuple itup; IndexTuple itup;
HashScanOpaque so; HashScanOpaque so;
...@@ -116,9 +115,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir) ...@@ -116,9 +115,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
_hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE); _hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum)); hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
itup = &hitem->hash_itup; itup = &hitem->hash_itup;
iptr = (ItemPointer) palloc(sizeof(ItemPointerData)); res = FormRetrieveIndexResult(current, &(itup->t_tid));
memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData));
res = FormRetrieveIndexResult(current, iptr);
return (res); return (res);
} }
...@@ -184,7 +181,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir) ...@@ -184,7 +181,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
HashItem hitem; HashItem hitem;
IndexTuple itup; IndexTuple itup;
ItemPointer current; ItemPointer current;
ItemPointer iptr;
OffsetNumber offnum; OffsetNumber offnum;
RetrieveIndexResult res; RetrieveIndexResult res;
HashScanOpaque so; HashScanOpaque so;
...@@ -245,9 +241,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir) ...@@ -245,9 +241,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
_hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE); _hash_checkpage(page, LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum)); hitem = (HashItem) PageGetItem(page, PageGetItemId(page, offnum));
itup = &hitem->hash_itup; itup = &hitem->hash_itup;
iptr = (ItemPointer) palloc(sizeof(ItemPointerData)); res = FormRetrieveIndexResult(current, &(itup->t_tid));
memmove((char *) iptr, (char *) &(itup->t_tid), sizeof(ItemPointerData));
res = FormRetrieveIndexResult(current, iptr);
return (res); return (res);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment