Memory leak problem

Поиск
Список
Период
Сортировка
От Tim Barnard
Тема Memory leak problem
Дата
Msg-id 018901c1dc34$8f4294c0$a519af3f@hartcomm.com
обсуждение исходный текст
Список pgsql-general
In the process of tracking down a bug in my application I came across a
possible memory leak problem in 7.2.1. In my code I had a situation where
"begin" was followed by a "close cursor1" followed by a "commit". Obviously
a coding error on my part but the question is should this sequence of steps
have caused a memory leak?

Here's a trivial example that'll demonstrate what I'm talking about:
(While monitoring with "top -d 1" it takes about 15 seconds or so before
memory used starts dramatically increasing)

NOTE: Omitting "close cursor1" and its subsequent PQclear causes the
apparent leak to not occur.
Also, the usual error trapping has been omitted from the code below.

#include "libpq-fe.h"

int main( int argc, char ** argv )
{
    PGconn * con_p;
    PGresult * rslt_p;
    con_p = PQconnectdb( "dbname=cvm" );
    if( con_p == NULL || PQstatus( con_p ) == COMMAND_BAD )
    {
        ... error logging, blah, blah...
    }
    while( true )
    {
        rslt_p = PQexec( "begin" );
        PQclear( rslt_p );
        rslt_p = PQexec( "close cursor1" );
        PQclear( rslt_p );
        rslt_p = PQexec( "commit" );
        PQclear( rslt_p );
    }
    return( 0 );
}

Tim


В списке pgsql-general по дате отправления:

Предыдущее
От: "Command Prompt, Inc."
Дата:
Сообщение: Re: PostgreSQL on Windows or MS-SQLServer???
Следующее
От: Jean-Michel POURE
Дата:
Сообщение: Re: no "ON INSERT ignore" in postgre?