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

Re: Memory leaks in PostgreSQL ODBC driver

From: mlw <markw(at)mohawksoft(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Memory leaks in PostgreSQL ODBC driver
Date: 2002-06-22 13:09:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
mlw wrote:
> It seems that when you perform a large query against the postgresql ODBC driver
> it sucks it all in to memory. If the query returns more data than you have
> memory, it fails. To change this behavior, you set UseDeclareFetch to yes.
> It seems that in QR_read_tuple, a buffer is allocated but never freed. Has
> anyone ever seen this before?
> I traced this in the unixODBC Postgre7.1 driver by replacing free/malloc with
> debug versions, and it looks like the PostgreSQL version has the same issue.
> Could this buffer be freed else where?

The Windows odbc driver does this as well, which is not surprising, given that
it is probably the same code.

Question, could this be because the ODBC cursor expects to be able to scroll
backwards? FORWARD_ONLY is the default, if I'm not mistaken.

In qresult.c:QR_next_tuple(), cache_size keeps growing. Shouldn't the driver
test for FORWARD_ONLY, in which case it should replace the previous chunk of
tuples, rather than add them?

Keeping all the previous tuples in a declare/fetch query, with a FORWARD_ONLY
cursor fundamentally cripples the ODBC driver for applications which intend to
process a great deal of data. I know I can't use the PostgreSQL ODBC driver for
my application.

In response to


pgsql-odbc by date

Next:From: Dave PageDate: 2002-06-22 19:56:20
Subject: Re: ODBC Patch to prevent setting of KSQO on 7.3+ servers
Previous:From: mlwDate: 2002-06-22 10:00:58
Subject: Memory leaks in PostgreSQL ODBC driver

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