Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d7e44f

Browse files
committed
Fix memory overhelding while forming index' result:
memory allocation for ItemPointerData of heap' tuple is uselessbecause of FormRetrieveIndexResult makes neccessary palloc.
1 parent05b3b86 commit5d7e44f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

‎src/backend/access/hash/hashsearch.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.7 1996/11/05 09:40:23 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/hash/hashsearch.c,v 1.8 1996/11/21 06:06:52 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -74,7 +74,6 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
7474
OffsetNumberoffnum;
7575
RetrieveIndexResultres;
7676
ItemPointercurrent;
77-
ItemPointeriptr;
7877
HashItemhitem;
7978
IndexTupleitup;
8079
HashScanOpaqueso;
@@ -116,9 +115,7 @@ _hash_next(IndexScanDesc scan, ScanDirection dir)
116115
_hash_checkpage(page,LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
117116
hitem= (HashItem)PageGetItem(page,PageGetItemId(page,offnum));
118117
itup=&hitem->hash_itup;
119-
iptr= (ItemPointer)palloc(sizeof(ItemPointerData));
120-
memmove((char*)iptr, (char*)&(itup->t_tid),sizeof(ItemPointerData));
121-
res=FormRetrieveIndexResult(current,iptr);
118+
res=FormRetrieveIndexResult(current,&(itup->t_tid));
122119

123120
return (res);
124121
}
@@ -184,7 +181,6 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
184181
HashItemhitem;
185182
IndexTupleitup;
186183
ItemPointercurrent;
187-
ItemPointeriptr;
188184
OffsetNumberoffnum;
189185
RetrieveIndexResultres;
190186
HashScanOpaqueso;
@@ -245,9 +241,7 @@ _hash_first(IndexScanDesc scan, ScanDirection dir)
245241
_hash_checkpage(page,LH_BUCKET_PAGE|LH_OVERFLOW_PAGE);
246242
hitem= (HashItem)PageGetItem(page,PageGetItemId(page,offnum));
247243
itup=&hitem->hash_itup;
248-
iptr= (ItemPointer)palloc(sizeof(ItemPointerData));
249-
memmove((char*)iptr, (char*)&(itup->t_tid),sizeof(ItemPointerData));
250-
res=FormRetrieveIndexResult(current,iptr);
244+
res=FormRetrieveIndexResult(current,&(itup->t_tid));
251245

252246
return (res);
253247
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp