pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Jochen Erwied <jochen@pgsql-bugs.erwied.eu>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Postgresql 9.1.2 - abnormal memory usage
Date: Mon, 12 Dec 2011 08:04:44 +0100
Message-ID: <1238340844.20111212080444@erwied.eu> (raw )
In-Reply-To: <201112120145.42463.andres@anarazel.de >
References: <396904450.20111211221529@erwied.eu >
<201112120045.23211.andres@anarazel.de >
<201112120145.42463.andres@anarazel.de >
Monday, December 12, 2011, 1:45:42 AM you wrote:
> Jochen, could you try the attached patch?
Patch is missing a variable define for 'r' in network_sup(). Fixed patch
attached.
Memory usage for insert ~1087MB - no change
Memory usage for index creation ~415MB - fixed.
Memory usage for select ~150MB - no increase, also fixed
The patch works for me, I'll leave the discussion if it's correct way to do
it to the developers :-)
--
Jochen Erwied | home: jochen@erwied.eu +49-208-38800-18, FAX: -19
Sauerbruchstr. 17 | work: joe@mbs-software.de +49-2151-7294-24, FAX: -50
D-45470 Muelheim | mobile: jochen.erwied@vodafone.de +49-173-5404164
Attachments:
0001-Release-memory-in-inet-functions.patch (application/octet-stream, 3.7K) download
diff -ru2 a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c
--- a/src/backend/utils/adt/network.c 2011-12-01 22:47:20.000000000 +0100
+++ b/src/backend/utils/adt/network.c 2011-12-12 07:41:50.672405741 +0100
@@ -461,5 +461,9 @@
inet *a2 = PG_GETARG_INET_P(1);
- PG_RETURN_INT32(network_cmp_internal(a1, a2));
+ int32 r = network_cmp_internal(a1, a2);
+
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_INT32(r);
}
@@ -473,5 +477,9 @@
inet *a2 = PG_GETARG_INET_P(1);
- PG_RETURN_BOOL(network_cmp_internal(a1, a2) < 0);
+ bool r = network_cmp_internal(a1, a2) < 0;
+
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -482,5 +490,9 @@
inet *a2 = PG_GETARG_INET_P(1);
- PG_RETURN_BOOL(network_cmp_internal(a1, a2) <= 0);
+ bool r = network_cmp_internal(a1, a2) <= 0;
+
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -491,5 +503,9 @@
inet *a2 = PG_GETARG_INET_P(1);
- PG_RETURN_BOOL(network_cmp_internal(a1, a2) == 0);
+ bool r = network_cmp_internal(a1, a2) == 0;
+
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -500,5 +516,9 @@
inet *a2 = PG_GETARG_INET_P(1);
- PG_RETURN_BOOL(network_cmp_internal(a1, a2) >= 0);
+ bool r = network_cmp_internal(a1, a2) >= 0;
+
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -509,5 +529,9 @@
inet *a2 = PG_GETARG_INET_P(1);
- PG_RETURN_BOOL(network_cmp_internal(a1, a2) > 0);
+ bool r = network_cmp_internal(a1, a2) > 0;
+
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -518,5 +542,9 @@
inet *a2 = PG_GETARG_INET_P(1);
- PG_RETURN_BOOL(network_cmp_internal(a1, a2) != 0);
+ bool r = network_cmp_internal(a1, a2) != 0;
+
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -542,12 +570,15 @@
inet *a1 = PG_GETARG_INET_P(0);
inet *a2 = PG_GETARG_INET_P(1);
+ bool r = false;
if (ip_family(a1) == ip_family(a2))
{
- PG_RETURN_BOOL(ip_bits(a1) > ip_bits(a2)
- && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a2)) == 0);
+ r = ip_bits(a1) > ip_bits(a2)
+ && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a2)) == 0;
}
- PG_RETURN_BOOL(false);
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -557,12 +588,15 @@
inet *a1 = PG_GETARG_INET_P(0);
inet *a2 = PG_GETARG_INET_P(1);
+ bool r = false;
if (ip_family(a1) == ip_family(a2))
{
- PG_RETURN_BOOL(ip_bits(a1) >= ip_bits(a2)
- && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a2)) == 0);
+ r = ip_bits(a1) >= ip_bits(a2)
+ && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a2)) == 0;
}
- PG_RETURN_BOOL(false);
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -572,12 +606,15 @@
inet *a1 = PG_GETARG_INET_P(0);
inet *a2 = PG_GETARG_INET_P(1);
+ bool r = false;
if (ip_family(a1) == ip_family(a2))
{
- PG_RETURN_BOOL(ip_bits(a1) < ip_bits(a2)
- && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a1)) == 0);
+ r = ip_bits(a1) < ip_bits(a2)
+ && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a1)) == 0;
}
- PG_RETURN_BOOL(false);
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
@@ -587,12 +624,15 @@
inet *a1 = PG_GETARG_INET_P(0);
inet *a2 = PG_GETARG_INET_P(1);
+ bool r = false;
if (ip_family(a1) == ip_family(a2))
{
- PG_RETURN_BOOL(ip_bits(a1) <= ip_bits(a2)
- && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a1)) == 0);
+ r = ip_bits(a1) <= ip_bits(a2)
+ && bitncmp(ip_addr(a1), ip_addr(a2), ip_bits(a1)) == 0;
}
- PG_RETURN_BOOL(false);
+ PG_FREE_IF_COPY(a1, 0);
+ PG_FREE_IF_COPY(a2, 1);
+ PG_RETURN_BOOL(r);
}
view thread (11+ messages) latest in thread
Message-ID: <1238340844.20111212080444@erwied.eu>
Permalink: ../1238340844.20111212080444@erwied.eu/
Also on: postgresql.org/message-id/1238340844.20111212080444@erwied.eu
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: jochen@pgsql-bugs.erwied.eu, andres@anarazel.de
Subject: Re: Postgresql 9.1.2 - abnormal memory usage
In-Reply-To: <1238340844.20111212080444@erwied.eu>
References: <396904450.20111211221529@erwied.eu> <201112120045.23211.andres@anarazel.de> <201112120145.42463.andres@anarazel.de> <1238340844.20111212080444@erwied.eu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox