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/
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4