Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 5E3C5635551 for ; Tue, 17 Nov 2009 23:27:46 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 70171-06 for ; Wed, 18 Nov 2009 03:27:38 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by mail.postgresql.org (Postfix) with SMTP id EDA796323C1 for ; Tue, 17 Nov 2009 23:27:37 -0400 (AST) Received: (qmail 14695 invoked by uid 512); 18 Nov 2009 03:27:34 -0000 Received: from unknown (HELO ?127.0.0.1?) (100.0.32.252) by sd2.tpf-fw-c.co.jp with SMTP; 18 Nov 2009 03:27:34 -0000 Message-ID: <4B036998.7020005@tpf.co.jp> Date: Wed, 18 Nov 2009 12:27:20 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.0 MIME-Version: 1.0 To: shoji.morimoto@soliton.co.jp CC: pgsql-odbc@postgresql.org Subject: Re: odbc driver leaks memory when connection failed References: <4B03517A.5060302@soliton.co.jp> In-Reply-To: <4B03517A.5060302@soliton.co.jp> 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=-1.117 tagged_above=-10 required=5 tests=BAYES_00=-2.599, DNS_FROM_RFC_BOGUSMX=1.482 X-Spam-Level: X-Archive-Number: 200911/19 X-Sequence-Number: 10068 shoji.morimoto@soliton.co.jp wrote: > Hello, > > The psotgre odbc driver seems leak memory when connection failed. Thanks for your report. I will take care of your suggestion. > 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. Does the leak occur even when libpq is not called ? regards, Hiroshi Inoue > 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