memory leak problem with arrays

sonjaa sonja.coussell at gmail.com
Thu Jun 15 18:42:30 CEST 2006


Fredrik Lundh wrote:
> <sonja.coussell at gmail.com> wrote:
> > After doing this I see that iterative counters used to collect occurrences
> > and nested loop counters (ii & jj) as seen in the code example below
> > are the culprits with the worst ones over 1M:
> >
> >                 for ii in xrange(0,40):
> >                    for jj in xrange(0,20):
> >                        try:
> >                            nc = y[a+ii,b+jj]
> >                        except IndexError: nc = 0
> >
> >                        if nc == "1" or nc == "5":
> >                            news = news +1
> >                            if news == 100:
> >                                break
> >                            else:
> >                                pass
> >                            y[a+ii,b+jj] = 4
> >                        else:
> >                            pass
> 
> what's "y" in this example ?
> 
> </F>

"y" is a 500x500 array.




More information about the Python-list mailing list