Group Abstract Group Abstract

Message Boards Message Boards

Memory use

GROUPS:
Due to my reckless use of Mathematica, now I have very little free space on my hard drive.
More precisely, the memory consumption appears to have occured due to execution of some unthinkable functions and quiting.

The problem persists if I relaunch Mathematica, and even after rebooting.

I regret my behavior, and I will be very grateful if someone tells me how can I free my space back.
POSTED BY: Sandu Ursu
Answer
7 months ago
What exactly did you do?  If you have filled up your hard drive with files generated by a function in Mathematica that has saved stuff to disk, then simply delete those files from your hard drive.
POSTED BY: David Reiss
Answer
7 months ago
I have asked Mathematica to compute some functions wihtout considering the computation time. Then.. after a couple of minutes, I have decided to Quit[].

I have done this several times. Do you suggest me copy the .nb and delete the original? Why would it save the stuff even after I close Mathematica?
POSTED BY: Sandu Ursu
Answer
7 months ago
I am somewhat confused.  You indicate that your hard disk is being filled as opposed to you running out of RAM memory.  What are you computing that woudl save things to yoru hard disk?
POSTED BY: David Reiss
Answer
7 months ago
As an update, I have restarted my laptop today and almost 5 GB were freed.
It seems that the system clears the "badly used" space when it reaches a very low limit.

I will post examples of as soon as I will encounter them again.
Maybe the problem lies somwere else, but I have observed that it happens to my laptop only when I use Mathematica.

Thanks so far!
POSTED BY: Sandu Ursu
Answer
7 months ago
Are you perhaps using far more memory than accessible in RAM, and generating a very large pagefile? Windows uses such a file for swapping in and out if RAM requirements exceed available RAM. I'm not to familiar with it, since I run Windows x64 and have 24 GBytes available, but I remember it. You might google pagefile.
POSTED BY: David Keith
Answer
7 months ago
So are you usaying that your problem iw with RAM usage rather than disk usage?  It woudl help if you would clarify your problem as per the requestion for further information. 
POSTED BY: David Reiss
Answer
7 months ago
David K.'s post seems to be a better description to the problem.

I have googled combinations of a number of keywords from this discussion (e.g. memory problem, Mathamtica, pagefile, RAM, clear, memoryinuse, etc), and got some results resembling my sitatuation.
Some of the most relevant:

http://forums.wolfram.com/mathgroup/archive/2009/Jun/msg00275.html
http://www.tomshardware.co.uk/forum/15101-63-pagefile-hiberfil-gigantic-filling
http://support.microsoft.com/kb/99768
http://support.microsoft.com/kb/314834

So it seems that Mathematica indeed uses my virtual memory. And a clarifying sentence: "A paging file is an area on the hard disk that Windows uses as if it were RAM".

Let it be that Mathematica will use my Hard Drive, but then my question is, how to clear this trash? ..because it seems to keep it even after I reboot my laptop and until the system realizes that the memory is too low already.
I would love to clear this memory from inside Mathematica, if not simply by restarting the program.

Also, I have noticed, that if I press "Alt+." early I can skip these kind of functions (highly recursive, requiring big amount of memory...), but when Mthematica enters into such functions deeper, then I cannot break the operations. The system becomes very slow, and if I try to do smth, it simply says "Not responding"... I can only hope that when it responds again I can go to Evaluation -> QuitKernel.

---
I use Windows 7, x64, 4GB RAM. 

Regarding the last link above, do I risk anything if I follow the specified paths and set Windows to "clear my pagefile at shudown"?


In the meantime I've found what risks I would face at: http://lifehacker.com/5426041/understanding-the-windows-pagefile-and-why-you-shouldnt-disable-it
POSTED BY: Sandu Ursu
Answer
7 months ago
Hi Sandu,

I do not often run low on RAM using mathematica, although it is perfectly possible to do so. I do use other tools which can push the limits of my 24Gbytes. The first clue is that you will see A LOT of disk activity, and the system will slow down immensely. It can be diffcult to interupt an application program with this problem because it is really an operating system activity. I find that once an application starts swapping to disk for RAM, it makes no real proress.  In the past, long ago, I recall freeing my disk space by finding and deleting the file pagefile.sys. Windows will just createanother one at need. So I see nothing wrong with telling Windows to clear the pagefile at shutdown. Any program  using it for swapping RAM is also shutting down.

Todays CAE tools make use of RAM extensively. They use far more RAM than was typically installed 10 years ago, and they use far more RAM than the 32-bit Windows versions support. I can't imagine doing real work today with anything less that 8GBytes of available memory, and for Windows, that requires the 64-bit version.

Best regards,
David
POSTED BY: David Keith
Answer
7 months ago
I just saw your link. Yes, I would not disable the pagefile system, but if ther's an option for Windows to clear it at shutdown I would do that.
POSTED BY: David Keith
Answer
7 months ago
I looked at the registry on my laptop. It runs Win 7 Pro x64 with 8GBytes RAM. It is not set to clear the pagefile at shutdown. But I don't fill RAM with Mathematica. I have at time with another tool, but have not had difficulties. I generally halt processing when I note that RAM is swapping to disk, and the other program (Comsol) might well clean up before exiting.
POSTED BY: David Keith
Answer
7 months ago
I have changed my settings (ClearPageFileAtShutdown = 1).

And I have restarted my laptop twice.. the shutting down time has increased to about 1.5 min (which might proove that it "works" or at least "does smth"). This is smth I can afford.
However, after the first restart, my space on C has shrinked by ~ 4 GB.. and it stayed there after the second restartation.

Don't know what to do.. emoticon
POSTED BY: Sandu Ursu
Answer
7 months ago
Find the offending file. You can do that by looking at "properties" of folders, to get their size. Methodically work into the tree, until you know what file is large. You may need to tell windows to not hide system files.
POSTED BY: David Keith
Answer
7 months ago
If the problem started recently then you might be able to make the file search process somewhat simpler by telling it to only look for files that were created after a particular date in the past. If the problem can be repeated you might even try to get to reproduce the problem the first thing tomorrow and the only look for files that were created or modified tomorrow. 

Just booting the computer can create or motify hundreds of files, and web browsing for a while before you remember to test Mathematica can create hundreds more, but that is a small fraction of the hundreds of thousands of files present of most systems today. Trying to narrow it down and perhaps post the list of files with locations and sizes might help someone figure out whether this is something that can be avoided in Mathematica.
POSTED BY: Bill Simpson
Answer
7 months ago