Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 805a397

Browse files
committed
Add more detail why repalloc and pfree do not accept NULL pointers
Per discussion, we choose not to change this. This just gives a little bit more information. Discussion: https://www.postgresql.org/message-id/flat/cf26e970-8e92-59f1-247a-aa265235075b%40enterprisedb.com
1 parent 36389a0 commit 805a397

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/backend/utils/mmgr/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ chunk might later be repalloc'd larger; it can also be pfree'd without
6767
error. Similarly, repalloc allows realloc'ing to zero size.
6868

6969
* pfree and repalloc do not accept a NULL pointer. This is intentional.
70+
(For repalloc, this is necessary: As mentioned above, repalloc does
71+
not depend on the current memory context. But then it needs to know
72+
which memory context to do the allocation in. So the first allocation
73+
has to be done outside of repalloc. For pfree, this behavior is
74+
mostly historical and partially because the extra check would impact
75+
performance.)
7076

7177

7278
The Current Memory Context

0 commit comments

Comments
 (0)