diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2022-08-28 09:55:04 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2022-08-28 09:55:04 +0200 |
commit | 805a397db40bd49789946e8fe42e564d564fc27b (patch) | |
tree | ea82eaf81b288c063e73bd2f934660a78c68a0f3 /src | |
parent | 36389a060ca6b44d6ccc67653da77562a1ac5bb4 (diff) | |
download | postgresql-805a397db40bd49789946e8fe42e564d564fc27b.tar.gz postgresql-805a397db40bd49789946e8fe42e564d564fc27b.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/mmgr/README | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/utils/mmgr/README b/src/backend/utils/mmgr/README index 221b4bd3433..777481c83d3 100644 --- a/src/backend/utils/mmgr/README +++ b/src/backend/utils/mmgr/README @@ -67,6 +67,12 @@ chunk might later be repalloc'd larger; it can also be pfree'd without error. Similarly, repalloc allows realloc'ing to zero size. * pfree and repalloc do not accept a NULL pointer. This is intentional. +(For repalloc, this is necessary: As mentioned above, repalloc does +not depend on the current memory context. But then it needs to know +which memory context to do the allocation in. So the first allocation +has to be done outside of repalloc. For pfree, this behavior is +mostly historical and partially because the extra check would impact +performance.) The Current Memory Context |