???Python Memory Management S***s???
fetchinson at googlemail.com
Sun Apr 20 11:12:19 CEST 2008
On 4/20/08, Hank @ITGroup <hank.infotec at gmail.com> wrote:
> Hi, people!
> These days I have been running a text processing program, written by
> python, of cause.
> In order to evaluate the memory operation, I used the codes below:
> > string1 = ['abcde']*999999 # this took up an obvious memory space...
> > del string1 # this freed the memory
> successfully !!
> For primary variants, the *del* thing works well. However, challenge the
> following codes, using class-instances...
> > from nltk import FreqDist # nltk stands for Natural Language Tool
> Kit (this is not an advertisement ~_~)
> > instance = FreqDist()
> > instanceList = [instance]*99999
> > del instanceList # You can try: nothing is freed by this
> ??? How do you people control python to free the memory in python 2.5 or
> python 2.4 ???
I don't know about the others, I personally let the garbage collector
take care of it.
More information about the Python-list