pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: li_gang02@sina.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6366: ECPG connection Memory Leak when using Host Variables
Date: Fri, 30 Dec 2011 04:50:41 +0000
Message-ID: <E1RgUQT-0006v7-6U@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      6366
Logged by:          Gang, Li
Email address:      li_gang02@sina.com
PostgreSQL version: 9.1.1
Operating system:   openSUSE 11.4 (AMD CPU, x86_64bits)
Description:        

Hallo,

/*
** PostgreSQL bug on ECPG connection when using Host Variables
**
**  Reference:
**     
http://doxygen.postgresql.org/interfaces_2ecpg_2ecpglib_2misc_8c_source.html#l00512
**  File:
**      postgresql-9.1.1/src/interfaces/ecpg/ecpglib/misc.c
**  Description:
**      Function ECPGset_var() will call calloc() to allocate memory for a
new node.
**      And all nodes are appended to a static global list named 'static
struct var_list'.
**      But the list memory is never been freed with free() in any case, and
no relative function
**          is available for me. After ECPG connection is disconnected,
ECPGset_var() resultes
**          in memory leak (TotalSize = n * sizeof(struct var_list), where n
is maxium
**          of Host Variables used in a DB Connection).
**
**  Bug Fixing:
**      A new function should be added, details as folloging
**          void ECPGfree_var()
**          {
**              struct var_list *workPtr = ivlist;
**              while (NULL != workPtr)
**              {
**                  ivlist = (struct var_list *)ivlist->next;
**                  free(workPtr);
**                  workPtr = ivlist;
**              }
**
**              ivlist = NULL;
**          }
**
**      Also, above function ECPGfree_var() should be called after all SQL
queries, and before
**      current ECPG connection is going to be closed.
*/


Best Regards,

Gang, Li




view thread (2+ messages)  latest in thread

Message-ID: <E1RgUQT-0006v7-6U@wrigleys.postgresql.org>
Permalink:  ../E1RgUQT-0006v7-6U@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1RgUQT-0006v7-6U@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: li_gang02@sina.com
  Subject: Re: BUG #6366: ECPG connection Memory Leak when using Host Variables
  In-Reply-To: <E1RgUQT-0006v7-6U@wrigleys.postgresql.org>
  References: <E1RgUQT-0006v7-6U@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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