forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd25c2ee
committed
In libpq, free any partial query result before collecting a server error.
We'd throw away the partial result anyway after parsing the error message.Throwing it away beforehand costs nothing and reduces the risk ofout-of-memory failure. Also, at least in systems that behave likeglibc/Linux, if the partial result was very large then the error PGresultwould get allocated at high heap addresses, preventing the heap storageused by the partial result from being released to the OS until the errorPGresult is freed.In psql >= 9.6, we hold onto the error PGresult until another error isreceived (for \errverbose), so that this behavior causes a seemingmemory leak to persist for awhile, as in a recent complaint fromDarafei Praliaskouski. This is a potential performance regression fromolder versions, justifying back-patching at least that far. But similarbehavior may occur in other client applications, so it seems worth justback-patching to all supported branches.Discussion:https://postgr.es/m/CAC8Q8tJ=7cOkPePyAbJE_Pf691t8nDFhJp0KZxHvnq_uicfyVg@mail.gmail.com1 parentfafec4c commitd25c2ee
2 files changed
+18
-2
lines changedLines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
966 | 966 |
| |
967 | 967 |
| |
968 | 968 |
| |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
969 | 977 |
| |
970 | 978 |
| |
971 | 979 |
| |
| |||
1038 | 1046 |
| |
1039 | 1047 |
| |
1040 | 1048 |
| |
1041 |
| - | |
| 1049 | + | |
1042 | 1050 |
| |
1043 | 1051 |
| |
1044 | 1052 |
| |
|
Lines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
879 | 879 |
| |
880 | 880 |
| |
881 | 881 |
| |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
882 | 890 |
| |
883 | 891 |
| |
884 | 892 |
| |
| |||
943 | 951 |
| |
944 | 952 |
| |
945 | 953 |
| |
946 |
| - | |
| 954 | + | |
947 | 955 |
| |
948 | 956 |
| |
949 | 957 |
| |
|
0 commit comments
Comments
(0)