Re: [Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-10 Thread frank wang

I am running in ipython. Now I do not have the problem anymore. %reset commands 
is a good solution.
 
Thanks
 
Frank Date: Tue, 9 Dec 2008 21:03:00 -0600 From: [EMAIL PROTECTED] To: 
numpy-discussion@scipy.org Subject: Re: [Numpy-discussion] how do I delete 
unused matrix to save the memory?  On Mon, Dec 8, 2008 at 19:15, frank wang 
[EMAIL PROTECTED] wrote:  Hi,   I have a program with some variables 
consume a lot of memory. The first time  I run it, it is fine. The second 
time I run it, I will get MemoryError. If I  close the ipython and reopen it 
again, then I can run the program once. I am  looking for a command to delete 
the intermediate variable once it is not  used to save memory like in matlab 
clear command.  How are you running this program? Be aware that IPython may 
be holding on to objects and preventing them from being deallocated. For 
example:  In [7]: !cat memtest.py class A(object): def __del__(self): 
print 'Deleting %r' % self   a = A()  In [8]: %run memtest.py  In [9]: 
%run memtest.py  In [10]: %run memtest.py  In [11]: del a  In [12]: Do 
you really want to exit ([y]/n)?  $ python memtest.py Deleting __main__.A 
object at 0x915ab0   You can remove some of these references with %reset 
and maybe a gc.collect() for good measure.   In [1]: %run memtest  In 
[2]: %run memtest  In [3]: %run memtest  In [4]: %reset Once deleted, 
variables cannot be recovered. Proceed (y/[n])? y Deleting __main__.A object 
at 0xf3e950 Deleting __main__.A object at 0xf3e6d0 Deleting __main__.A 
object at 0xf3e930  --  Robert Kern  I have come to believe that the 
whole world is an enigma, a harmless enigma that is made terrible by our own 
mad attempt to interpret it as though it had an underlying truth. -- Umberto 
Eco ___ Numpy-discussion mailing 
list Numpy-discussion@scipy.org 
http://projects.scipy.org/mailman/listinfo/numpy-discussion
_
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-09 Thread Vagabond_Aero
I have the same problem.  I tried the del command below, but foundon that it
removes the names of the ndarrays from memory, but does not free up the
memory on my XP system (python 2.5.2, numpy 1.2.1).  Regular python objects
release their memory when I use the del command, but it looks like the
ndarray objects do not.

On Mon, Dec 8, 2008 at 22:00, Travis Vaught [EMAIL PROTECTED] wrote:

 Try:

 del(myvariable)

 Travis

 On Dec 8, 2008, at 7:15 PM, frank wang [EMAIL PROTECTED] wrote:

 Hi,

 I have a program with some variables consume a lot of memory. The first
 time I run it, it is fine. The second time I run it, I will get MemoryError.
 If I close the ipython and reopen it again, then I can run the program once.
 I am looking for a command to delete the intermediate variable once it is
 not used to save memory like in matlab clear command.

 Thanks

 Frank

 --
 Send e-mail faster without improving your typing skills. Get your Hotmail(R)
 account.http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008

 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion


 ___
 Numpy-discussion mailing list
 Numpy-discussion@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion


___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-09 Thread Robert Kern
On Tue, Dec 9, 2008 at 20:40, Vagabond_Aero [EMAIL PROTECTED] wrote:
 I have the same problem.  I tried the del command below, but foundon that it
 removes the names of the ndarrays from memory, but does not free up the
 memory on my XP system (python 2.5.2, numpy 1.2.1).  Regular python objects
 release their memory when I use the del command, but it looks like the
 ndarray objects do not.

It's not guaranteed that the regular Python objects return memory to
the OS, either. The memory should be reused when Python allocates new
memory, though, so I suspect that this is not the problem that Frank
is seeing.

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-09 Thread Robert Kern
On Mon, Dec 8, 2008 at 19:15, frank wang [EMAIL PROTECTED] wrote:
 Hi,

 I have a program with some variables consume a lot of memory. The first time
 I run it, it is fine. The second time I run it, I will get MemoryError. If I
 close the ipython and reopen it again, then I can run the program once. I am
 looking for a command to delete the intermediate variable once it is not
 used to save memory like in matlab clear command.

How are you running this program? Be aware that IPython may be holding
on to objects and preventing them from being deallocated. For example:

In [7]: !cat memtest.py
class A(object):
def __del__(self):
print 'Deleting %r' % self


a = A()

In [8]: %run memtest.py

In [9]: %run memtest.py

In [10]: %run memtest.py

In [11]: del a

In [12]:
Do you really want to exit ([y]/n)?

$ python memtest.py
Deleting __main__.A object at 0x915ab0


You can remove some of these references with %reset and maybe a
gc.collect() for good measure.


In [1]: %run memtest

In [2]: %run memtest

In [3]: %run memtest

In [4]: %reset
Once deleted, variables cannot be recovered. Proceed (y/[n])?  y
Deleting __main__.A object at 0xf3e950
Deleting __main__.A object at 0xf3e6d0
Deleting __main__.A object at 0xf3e930

-- 
Robert Kern

I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth.
  -- Umberto Eco
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-09 Thread Scott Sinclair
 2008/12/10 Robert Kern [EMAIL PROTECTED]:
 On Mon, Dec 8, 2008 at 19:15, frank wang [EMAIL PROTECTED] wrote:
 Hi,

 I have a program with some variables consume a lot of memory. The first time
 I run it, it is fine. The second time I run it, I will get MemoryError. If I
 close the ipython and reopen it again, then I can run the program once. I am
 looking for a command to delete the intermediate variable once it is not
 used to save memory like in matlab clear command.

 How are you running this program? Be aware that IPython may be holding
 on to objects and preventing them from being deallocated. For example:

 In [7]: !cat memtest.py
 class A(object):
def __del__(self):
print 'Deleting %r' % self


 a = A()

 In [8]: %run memtest.py

 In [9]: %run memtest.py

 In [10]: %run memtest.py

 In [11]: del a

 In [12]:
 Do you really want to exit ([y]/n)?

 $ python memtest.py
 Deleting __main__.A object at 0x915ab0


 You can remove some of these references with %reset and maybe a
 gc.collect() for good measure.

Of course, if you don't need to have access to the variables created
in your program from the IPython session, you can run the program in a
separate python process:

In [1]: !python memtest.py
Deleting __main__.A object at 0xb7da5ccc

In [2]: !python memtest.py
Deleting __main__.A object at 0xb7e5fccc

Cheers,
Scott
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-08 Thread frank wang

Hi,
 
I have a program with some variables consume a lot of memory. The first time I 
run it, it is fine. The second time I run it, I will get MemoryError. If I 
close the ipython and reopen it again, then I can run the program once. I am 
looking for a command to delete the intermediate variable once it is not used 
to save memory like in matlab clear command.
 
Thanks
 
Frank
_
Send e-mail faster without improving your typing skills.
http://windowslive.com/Explore/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_speed_122008___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] how do I delete unused matrix to save the memory?

2008-12-08 Thread Travis Vaught

Try:

del(myvariable)

Travis

On Dec 8, 2008, at 7:15 PM, frank wang [EMAIL PROTECTED] wrote:


Hi,

I have a program with some variables consume a lot of memory. The  
first time I run it, it is fine. The second time I run it, I will  
get MemoryError. If I close the ipython and reopen it again, then I  
can run the program once. I am looking for a command to delete the  
intermediate variable once it is not used to save memory like in  
matlab clear command.


Thanks

Frank

Send e-mail faster without improving your typing skills. Get your  
HotmailĀ® account.

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion