pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
libpq++ memory problems
6+ messages / 3 participants
[nested] [flat]

* libpq++ memory problems
@ 2000-04-17 20:10 Tim Brookes <tim.brookes@mcmail.com>
  2000-04-18 00:51 ` Re: libpq++ memory problems Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Tim Brookes @ 2000-04-17 20:10 UTC (permalink / raw)
  To: pgsql-interfaces

I have written the following small piece of code to illustrate my
problem.

#include <pgsql/libpq++.h>

void callproc(){
   PgDatabase* loStatsdb;
   PgEnv loEnv("","","","","");

   loStatsdb = new PgDatabase(loEnv,"ftldb");
   delete loStatsdb;
};

main(){
   while(1){
      callproc();
   };
};

The procedure 'callproc' is called in a continuous loop to emphasise
this problem.  Within the procedure all that happens is a new database
connection is made and deleted.  On my system this eats memory at an
enormous rate.

I do not know if this problem has been discussed before or fixed in
newer versions of the library (my apologies if it has), but I would be
most grateful of any info on resolving this memory leak.

Tim Brookes




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: libpq++ memory problems
  2000-04-17 20:10 libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
@ 2000-04-18 00:51 ` Tom Lane <tgl@sss.pgh.pa.us>
  2000-04-20 07:59   ` Re: libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2000-04-18 00:51 UTC (permalink / raw)
  To: Tim Brookes <tim.brookes@mcmail.com>; +Cc: pgsql-interfaces

Tim Brookes <tim.brookes@mcmail.com> writes:
> The procedure 'callproc' is called in a continuous loop to emphasise
> this problem.  Within the procedure all that happens is a new database
> connection is made and deleted.  On my system this eats memory at an
> enormous rate.

I could not reproduce such a leak with current sources.

It appears that you are using a fairly old Postgres release --- class
PgEnv hasn't existed since at least release 6.4.*, maybe earlier.
I'd suggest upgrading...

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: libpq++ memory problems
  2000-04-17 20:10 libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
  2000-04-18 00:51 ` Re: libpq++ memory problems Tom Lane <tgl@sss.pgh.pa.us>
@ 2000-04-20 07:59   ` Tim Brookes <tim.brookes@mcmail.com>
  2000-04-20 15:06     ` Re: libpq++ memory problems Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Tim Brookes @ 2000-04-20 07:59 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces

OK

So I have downloaded and set up version 6.5.3 on a test system.  I then
altered the code on the example so that it no longer uses the PgEnv class.
I set my environment variable and ran the program now as below.  I still get
a huge memory leak.

Can I ask you what version you are using?

callproc(){
   PgDatabase* loStatsdb;

   loStatsdb = new PgDatabase("");
   delete loStatsdb;
};

main(){
    while(1){
        callproc();
    };
};

Rgds
Tim Brookes


Tom Lane wrote:

> Tim Brookes <tim.brookes@mcmail.com> writes:
> > The procedure 'callproc' is called in a continuous loop to emphasise
> > this problem.  Within the procedure all that happens is a new database
> > connection is made and deleted.  On my system this eats memory at an
> > enormous rate.
>
> I could not reproduce such a leak with current sources.
>
> It appears that you are using a fairly old Postgres release --- class
> PgEnv hasn't existed since at least release 6.4.*, maybe earlier.
> I'd suggest upgrading...
>
>                         regards, tom lane




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: libpq++ memory problems
  2000-04-17 20:10 libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
  2000-04-18 00:51 ` Re: libpq++ memory problems Tom Lane <tgl@sss.pgh.pa.us>
  2000-04-20 07:59   ` Re: libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
@ 2000-04-20 15:06     ` Tom Lane <tgl@sss.pgh.pa.us>
  2000-04-20 15:24       ` Re: libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2000-04-20 15:06 UTC (permalink / raw)
  To: Tim Brookes <tim.brookes@mcmail.com>; +Cc: pgsql-interfaces

Tim Brookes <tim.brookes@mcmail.com> writes:
> So I have downloaded and set up version 6.5.3 on a test system.  I then
> altered the code on the example so that it no longer uses the PgEnv class.
> I set my environment variable and ran the program now as below.  I still get
> a huge memory leak.

> Can I ask you what version you are using?

Current CVS sources --- ie, 7.0RC1 plus or minus a little bit.  But as
far as I can tell from the CVS logs, not much has been done to libpq++
since 6.5; there's certainly nothing in the logs about fixing memory
leaks.  So I'd have expected 6.5 to behave the same.  Interesting.

> callproc(){
>    PgDatabase* loStatsdb;

>    loStatsdb = new PgDatabase("");
>    delete loStatsdb;
> };

> main(){
>     while(1){
>         callproc();
>     };
> };

AFAIR, my test program looked just like that except it specified a
database name --- new PgDatabase("dbname=regression") or some such.

I wonder if it could be platform- or configuration-specific.  What
options did you give to configure?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: libpq++ memory problems
  2000-04-17 20:10 libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
  2000-04-18 00:51 ` Re: libpq++ memory problems Tom Lane <tgl@sss.pgh.pa.us>
  2000-04-20 07:59   ` Re: libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
  2000-04-20 15:06     ` Re: libpq++ memory problems Tom Lane <tgl@sss.pgh.pa.us>
@ 2000-04-20 15:24       ` Tim Brookes <tim.brookes@mcmail.com>
  2000-04-20 15:37         ` Re: libpq++ memory problems Lamar Owen <lamar.owen@wgcr.org>
  0 siblings, 1 reply; 6+ messages in thread

From: Tim Brookes @ 2000-04-20 15:24 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-interfaces

Tom

I did not use configure - I downloaded a set of RPMs for 6.5.3
I then just changed the program not to require PgEnv and then compiled,linked with
the libpq++ library.

Maybe I should download the sources and compile on my system, but I dont see how
that will change what I see as momory not being released in the PgDatabase
destructor.

Rgds
Tim

Tom Lane wrote:

> Tim Brookes <tim.brookes@mcmail.com> writes:
> > So I have downloaded and set up version 6.5.3 on a test system.  I then
> > altered the code on the example so that it no longer uses the PgEnv class.
> > I set my environment variable and ran the program now as below.  I still get
> > a huge memory leak.
>
> > Can I ask you what version you are using?
>
> Current CVS sources --- ie, 7.0RC1 plus or minus a little bit.  But as
> far as I can tell from the CVS logs, not much has been done to libpq++
> since 6.5; there's certainly nothing in the logs about fixing memory
> leaks.  So I'd have expected 6.5 to behave the same.  Interesting.
>
> > callproc(){
> >    PgDatabase* loStatsdb;
>
> >    loStatsdb = new PgDatabase("");
> >    delete loStatsdb;
> > };
>
> > main(){
> >     while(1){
> >         callproc();
> >     };
> > };
>
> AFAIR, my test program looked just like that except it specified a
> database name --- new PgDatabase("dbname=regression") or some such.
>
> I wonder if it could be platform- or configuration-specific.  What
> options did you give to configure?
>
>                         regards, tom lane




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: libpq++ memory problems
  2000-04-17 20:10 libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
  2000-04-18 00:51 ` Re: libpq++ memory problems Tom Lane <tgl@sss.pgh.pa.us>
  2000-04-20 07:59   ` Re: libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
  2000-04-20 15:06     ` Re: libpq++ memory problems Tom Lane <tgl@sss.pgh.pa.us>
  2000-04-20 15:24       ` Re: libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
@ 2000-04-20 15:37         ` Lamar Owen <lamar.owen@wgcr.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Lamar Owen @ 2000-04-20 15:37 UTC (permalink / raw)
  To: Tim Brookes <tim.brookes@mcmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-interfaces

Tim Brookes wrote:
> 
> Tom
> 
> I did not use configure - I downloaded a set of RPMs for 6.5.3
> I then just changed the program not to require PgEnv and then compiled,linked with
> the libpq++ library.

To answer Tom's question:

> > I wonder if it could be platform- or configuration-specific.  What
> > options did you give to configure?

To which I can answer, if it was my RPMset he downloaded:
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr \
	--enable-hba --enable-locale \
	--with-perl --with-mb=SQL_ASCII\
	--with-tcl --with-tk --with-x \
	--with-odbc --with-java \
	--with-python

--
Lamar Owen
WGCR Internet Radio
1 Peter 4:11



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2000-04-20 15:37 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-04-17 20:10 libpq++ memory problems Tim Brookes <tim.brookes@mcmail.com>
2000-04-18 00:51 ` Tom Lane <tgl@sss.pgh.pa.us>
2000-04-20 07:59   ` Tim Brookes <tim.brookes@mcmail.com>
2000-04-20 15:06     ` Tom Lane <tgl@sss.pgh.pa.us>
2000-04-20 15:24       ` Tim Brookes <tim.brookes@mcmail.com>
2000-04-20 15:37         ` Lamar Owen <lamar.owen@wgcr.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox