Skip site navigation (1) Skip section navigation (2)

Re: odbc driver leaks memory when connection failed

From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: shoji(dot)morimoto(at)soliton(dot)co(dot)jp
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: odbc driver leaks memory when connection failed
Date: 2009-11-18 03:27:20
Message-ID: 4B036998.7020005@tpf.co.jp (view raw or flat)
Thread:
Lists: pgsql-odbc
shoji(dot)morimoto(at)soliton(dot)co(dot)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 <shoji(dot)morimoto(at)soliton(dot)co(dot)jp>
> Soliton Systems +81-3-5360-3830 FAX+81-3-5379-0280 



In response to

Responses

pgsql-odbc by date

Next:From: shoji.morimotoDate: 2009-11-18 07:40:41
Subject: Re: odbc driver leaks memory when connection failed
Previous:From: shoji.morimotoDate: 2009-11-18 01:44:26
Subject: odbc driver leaks memory when connection failed

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group