Ask Your Question
0

Use 'reset()' in a script

asked 2013-09-24 08:08:32 +0100

mresimulator gravatar image

Hi experts!!

Can I use reset() in a script?

For example, if numpy arrays A, B and C are creted and i wanna free thre RAM used. Can I use reset(A,B,C) for that?

Waiting for your answers.

Thanks a lot

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-09-24 09:58:21 +0100

kcrisman gravatar image

This is something you can pretty much try for yourself.

$ cat test.sage 
A = matrix([[1,2,3],[4,5,6]])
print A
reset()
print A
$ sage test.sage 
[1 2 3]
[4 5 6]
Traceback (most recent call last):
  File "test.py", line 7, in <module>
    print A
NameError: name 'A' is not defined

So I guess it works.

edit flag offensive delete link more

Comments

Thanks! Do it help to clear memory ocupated by matrix A?

mresimulator gravatar imagemresimulator ( 2013-09-24 11:31:32 +0100 )edit
1

answered 2013-09-24 11:31:34 +0100

mresimulator gravatar image

Thanks!

Do it help to clear memory ocupated by matrix A?

edit flag offensive delete link more

Comments

I guess that depends on the Python garbage collector. Hopefully someone else can answer that, I'm not sure how often that does its thing.

kcrisman gravatar imagekcrisman ( 2013-09-24 13:38:01 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-09-24 08:08:32 +0100

Seen: 703 times

Last updated: Sep 24 '13