???Python Memory Management S***s???
Daniel Fetchinson
fetchinson at googlemail.com
Sun Apr 20 05:12:19 EDT 2008
On 4/20/08, Hank @ITGroup <hank.infotec at gmail.com> wrote:
> Hi, people!
>
> Greetings~
> 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 ???
> Cheers!!!
I don't know about the others, I personally let the garbage collector
take care of it.
HTH,
Daniel
More information about the Python-list
mailing list