Unreasonable memory usage under linux with a simple loop

2009-01-02 Thread ming_cuhk
Hi all, I'm new to here and python.
When I tried the code below to test python's speed...
I found that python use more than 1.5G memory to run this and cost
several minutes And this happened only under my linux os. Both
jython and python...  Is there something wrong with python under linux
or my code?
Thanks!

a = 0
for i in range(1):
a = a + 1
print a


--
http://mail.python.org/mailman/listinfo/python-list


Re: Unreasonable memory usage under linux with a simple loop

2009-01-02 Thread ming_cuhk
On Jan 2, 11:49 pm, Michele Simionato 
wrote:
> On Jan 2, 4:45 pm, ming_cuhk  wrote:
>
> > Hi all, I'm new to here and python.
> > When I tried the code below to test python's speed...
> > I found that python use more than 1.5G memory to run this and cost
> > several minutes And this happened only under my linux os. Both
> > jython and python...  Is there something wrong with python under linux
> > or my code?
> > Thanks!
>
> > a = 0
> > for i in range(1):
> >     a = a + 1
> > print a
>
> This is fixed in Python 3.0. In older Python versions, use
> xrange instead of range.

Thanks! But this isn't appear in MAC and Windows~?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Unreasonable memory usage under linux with a simple loop

2009-01-02 Thread ming_cuhk
On Jan 2, 11:52 pm, Michele Simionato 
wrote:
> On Jan 2, 4:50 pm, ming_cuhk  wrote:
>
>
>
> > On Jan 2, 11:49 pm, Michele Simionato 
> > wrote:
>
> > > On Jan 2, 4:45 pm, ming_cuhk  wrote:
>
> > > > Hi all, I'm new to here and python.
> > > > When I tried the code below to test python's speed...
> > > > I found that python use more than 1.5G memory to run this and cost
> > > > several minutes And this happened only under my linux os. Both
> > > > jython and python...  Is there something wrong with python under linux
> > > > or my code?
> > > > Thanks!
>
> > > > a = 0
> > > > for i in range(1):
> > > >     a = a + 1
> > > > print a
>
> > > This is fixed in Python 3.0. In older Python versions, use
> > > xrange instead of range.
>
> > Thanks! But this isn't appear in MAC and Windows~?
>
> It should happen on all platforms, since you are building
> a list with 100 millions of integers, which is quite large,
> especially if you are running on a 64 bit OS.

You are right...Thanks Since my MAC have too much RAM..I didn't
notice it
--
http://mail.python.org/mailman/listinfo/python-list