[Python-bugs-list] [Bug #110666] PRIVATE: interned->ma_table never free'd (PR#361)

noreply@sourceforge.net noreply@sourceforge.net
Thu, 7 Sep 2000 15:04:14 -0700


Bug #110666, was updated on 2000-Jul-31 14:12
Here is a current snapshot of the bug.

Project: Python
Category: None
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: PRIVATE: interned->ma_table never free'd (PR#361)

Details: Jitterbug-Id: 361
Submitted-By: cfandrich@8cs.com
Date: Fri, 16 Jun 2000 20:08:33 -0400 (EDT)
Version: 1.5.2
OS: Windows


I'm embedding Python in an application.  For now, all I'm doing is initializing
and finalizing Python.

When I run my app I get a memory leak of 12288 bytes.  The memory is malloc'ed
by dictresize() which is called by PyDict_SetItem() which is called by
PyString_InternInPlace().

For now, I've added 
    PyDict_Clear(interned);
    interned = NULL;
to PyString_Fini().  So far it works fine, but I don't know if it's safe to do
in the grand scheme of things.

-Chris




====================================================================
Audit trail:
Tue Jul 11 08:26:01 2000	guido	moved from incoming to open

Follow-Ups:

Date: 2000-Aug-01 14:01
By: none

Comment:
From: "M.-A. Lemburg" <mal@lemburg.com>
Subject: Re: [Python-bugs-list] PRIVATE: interned->ma_table never free'd (PR#361)
Date: Sat, 17 Jun 2000 10:53:20 +0200

cfandrich@8cs.com wrote:
> 
> Full_Name: Christopher Fandrich
> Version: 1.5.2
> OS: Windows
> Submission from: (NULL) (208.41.174.4)
> 
> I'm embedding Python in an application.  For now, all I'm doing is initializing
> and finalizing Python.
> 
> When I run my app I get a memory leak of 12288 bytes.  The memory is malloc'ed
> by dictresize() which is called by PyDict_SetItem() which is called by
> PyString_InternInPlace().
> 
> For now, I've added
>     PyDict_Clear(interned);
>     interned = NULL;
> to PyString_Fini().  So far it works fine, but I don't know if it's safe to do
> in the grand scheme of things.

I would suggest adding code to dealloc the interned dict
iff it is empty after the sweeping action in PyString_Fini().
I have a feeling that this is not the case though, since interned
strings are used quite a lot in the core interpreter (e.g. in
classobject.c) and these are usually not recovered.

Perhaps we ought to add some code which takes care of cleaning
up all remaining garbage left over after the call to
call_ll_exitfuncs() in Py_Finalize(), e.g. force free'ing
of all interned strings and cached ints/floats and associated
free lists or dicts.

We'd need new APIs in string|float|intobject.c to implement this.

Thoughts ? Patches ?

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/


-------------------------------------------------------

Date: 2000-Sep-07 15:04
By: jhylton

Comment:
Please do triage on this bug.
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110666&group_id=5470