[ZCM] [ZC] 2324/ 1 Request "Memory leak in Shared.DC.ZRDB.Results.SQLAlias"

"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Wed, 16 May 2007 11:37:56 -0400
Newsgroups gmane.comp.web.zope.devel.collector-monitor
Message-ID <[email protected]>
Issue #2324 Update (Request) "Memory leak in Shared.DC.ZRDB.Results.SQLAlias"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2324

==============================================================
= Request - Entry #1 by brunni on May 16, 2007 11:37 am

A leak happens with objects of class Shared.DC.ZRDB.Results.SQLAlias, when
using traversal with a Z SQL Method.

1. Create a Z SQL Method named 'Sql' with one argument named 'my_arg':

      SELECT my_column AS my_column_alias
      FROM my_table
      WHERE my_primary_key = '<dtml-var my_arg sql_quote>'

   check 'Allow "simple" direct traversal' in Advanced.

2. Create a DTML Document named 'Leak':

      <dtml-var my_column_alias>

Then each time calling http://<host>/Sql/1/Leak, one additional Instance of
Shared.DC.ZRDB.Results.SQLAlias (a new str instance with value
'my_column_alias' being referenced by it's attribute _n)
will be created but never again freed unless Zope is restarted.

Notes:

- We used a python 2.4.4 build with Py_TRACE_REFS switched on.
- Cyclic garbage collection is active, but gc.collect() does not free the
  SQLAlias instances. (sys.getrefcount() says 4)

==============================================================