Thread: Possible memory leak in Postgres V7.0.2/ecpg 2.7.1

Possible memory leak in Postgres V7.0.2/ecpg 2.7.1

From
buhrow@lothlorien.nfbcal.org (Brian Buhrow)
Date:
    Hello.  I'm brand new to this list, and fairly new to postgres.
I'm in the midst of writing a database application on top of Postgres
V7.0.2, using ecpg V2.7.1, included with the package.  I find that running
a batch client I wrote leaks memory to the extent that the client bombs out
a quarter of the way through its job.  Thinking it was my code, I traced
through the truss/ktrace output to determine when memory requests were
coming in to the OS from the process in question.  After my
initializations, I discovered that it appears that all subsequent memory
requests come in when the application is executing ecpg code.  Since I'm
not particularly familiar with the innards of the ecpg code, I thought I
would ask if anyone has seen this sort of problem before.  My sql code is
not particularly complicated, but I am using cursors, and it seems that
these allocations happen just before "declare cursor" is executed.  Can
anyone help shed light on what might be going on, and how I might fix it?
I can provide traces if that would help, as well as any debugging
statements, if someone can tell me how to turn them on.Many thanks in advance.
-Brian




Re: Possible memory leak in Postgres V7.0.2/ecpg 2.7.1

From
Michael Meskes
Date:
On Mon, Dec 18, 2000 at 10:21:47AM -0800, Brian Buhrow wrote:
> V7.0.2, using ecpg V2.7.1, included with the package.  I find that running
> a batch client I wrote leaks memory to the extent that the client bombs out
> a quarter of the way through its job.  Thinking it was my code, I traced
> ...
> not particularly familiar with the innards of the ecpg code, I thought I
> would ask if anyone has seen this sort of problem before.  My sql code is

I'm not sure. I've got some reports that I couldn't reproduce though.

> not particularly complicated, but I am using cursors, and it seems that
> these allocations happen just before "declare cursor" is executed.  Can

Before it is executed or before the exec sql declare statement?

> anyone help shed light on what might be going on, and how I might fix it?
> I can provide traces if that would help, as well as any debugging
> statements, if someone can tell me how to turn them on.

Just look into the test examples in the source code if you have them. Or
else I can send them to you. But the log won't help you much I guess. 

Are you able to try ecpg 2.8.0 and libecpg 3.2.0? I can send you the source
if you like.

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!


Re: Possible memory leak in Postgres V7.0.2/ecpg 2.7.1

From
buhrow@lothlorien.nfbcal.org (Brian Buhrow)
Date:
Thanks for the reply.  Yes, the allocations are requested
just before the exec sql declare cursor statement.  
Yes, I've been using the example test sources  as examples on how to
interface with ecpg, but the comments in those sources are not verbose.  Is
there a good book which more fully describes the features of ecpg?I could use the new ecpg 2.8.0 just after the first
ofthe year, 
 
so if you could send it to me, that would be great.
-Brian
On Dec 20,  2:31am, Michael Meskes wrote:
} Subject: Re: Possible memory leak in Postgres V7.0.2/ecpg 2.7.1
} On Mon, Dec 18, 2000 at 10:21:47AM -0800, Brian Buhrow wrote:
} > V7.0.2, using ecpg V2.7.1, included with the package.  I find that running
} > a batch client I wrote leaks memory to the extent that the client bombs out
} > a quarter of the way through its job.  Thinking it was my code, I traced
} > ...
} > not particularly familiar with the innards of the ecpg code, I thought I
} > would ask if anyone has seen this sort of problem before.  My sql code is
} 
} I'm not sure. I've got some reports that I couldn't reproduce though.
} 
} > not particularly complicated, but I am using cursors, and it seems that
} > these allocations happen just before "declare cursor" is executed.  Can
} 
} Before it is executed or before the exec sql declare statement?
} 
} > anyone help shed light on what might be going on, and how I might fix it?
} > I can provide traces if that would help, as well as any debugging
} > statements, if someone can tell me how to turn them on.
} 
} Just look into the test examples in the source code if you have them. Or
} else I can send them to you. But the log won't help you much I guess. 
} 
} Are you able to try ecpg 2.8.0 and libecpg 3.2.0? I can send you the source
} if you like.
} 
} Michael
} -- 
} Michael Meskes
} Michael@Fam-Meskes.De
} Go SF 49ers! Go Rhein Fire!
} Use Debian GNU/Linux! Use PostgreSQL!
>-- End of excerpt from Michael Meskes




Re: Possible memory leak in Postgres V7.0.2/ecpg 2.7.1

From
Michael Meskes
Date:
On Tue, Dec 19, 2000 at 10:14:36AM -0800, Brian Buhrow wrote:
>     Thanks for the reply.  Yes, the allocations are requested
> just before the exec sql declare cursor statement.  

Now that is interesting, because the declare statement has no operation. It
gets executed at the open cursor statement. So only the preprocessor itself
can eat memory here.

> Yes, I've been using the example test sources  as examples on how to
> interface with ecpg, but the comments in those sources are not verbose.  Is
> there a good book which more fully describes the features of ecpg?

Unfortunately there is not enough documentation available.

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!