Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 5263B6323C1 for ; Tue, 17 Nov 2009 21:44:46 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 09123-08 for ; Wed, 18 Nov 2009 01:44:14 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ipo01.soliton.co.jp (ipo01.soliton.co.jp [160.239.10.17]) by mail.postgresql.org (Postfix) with ESMTP id 36D73634120 for ; Tue, 17 Nov 2009 21:44:29 -0400 (AST) X-IronPort-AV: E=Sophos;i="4.44,761,1249225200"; d="scan'208";a="12960479" Received: from unknown (HELO [127.0.0.1]) ([10.30.253.139]) by iport.soliton.co.jp with ESMTP; 18 Nov 2009 10:44:27 +0900 Message-ID: <4B03517A.5060302@soliton.co.jp> Date: Wed, 18 Nov 2009 10:44:26 +0900 From: shoji.morimoto@soliton.co.jp User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: pgsql-odbc@postgresql.org Subject: odbc driver leaks memory when connection failed Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200911/18 X-Sequence-Number: 10067 Hello, The psotgre odbc driver seems leak memory when connection failed. 1) A program tries to connect through odbc to a psotgres server running another machine. 2) Remove the network cable from the odbc guest machine ( not from the server machine ). 3) Then memory leaks every time connection fails. 4) Leak size is small when SSL is OFF and big when SSL is ON. 20 KB to 40 KB each when SSL is ON. 5) I tried odbc version 8.3.4 and 8.4.1, and both occurred leak. Here I try to guess the cause in the odbc driver source code. socket.c SOCK_Destructor(SocketClass *self) { mylog("SOCK_Destructor\n"); if (!self) return; if (self->socket != (SOCKETFD) -1) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I think this part is wrong and unnecessary. It is because... When LIBPQ_connect failed to connect on some conditions, it leaves : - self->sock->socket = -1 and.. - selc->sock->pqconn = pqconn ( unfreed. ) -------------------------------------------------- MORIMOTO Shouji Soliton Systems +81-3-5360-3830 FAX+81-3-5379-0280