Message Boards Message Boards

5 Replies
3 Total Likes
View groups...
Share this post:

Why Version 10 seems to be much more memory hungry?

Posted 10 years ago
POSTED BY: Nasser M. Abbasi
5 Replies

I do not know what is behind this particular issue. With regard to Linux handling of memory issues, on Ubuntu at least I can say that it is miserable (at least with default settings). Actually it has been miserable on every Linux I have used, so it's not specific to Ubuntu. I often wish there were a dedicated part of reptilian brain in the OS that was reserved for killing rogue processes, and moreover was always reachable (without waiting 30 minutes and getting a lucky process swap). Probably this is an engineering impossibility.

(Had to reboot twice last week, and still annoyed.)

POSTED BY: Daniel Lichtblau

Starting the code with


is a better way to keep unsaved intermediate values from cluttering memory than with


RandomReal has been around since 6.0. (Faster and more memory-efficient than Table[Random[],...)

In[1]:= n = 7000;                                                                       

In[2]:= $HistoryLength=0;                                                               

In[3]:= Timing[ Table[Random[], {i, 1, n}, {j, 1, n}]; ]                                
Out[3]= {17.960200, Null}

In[4]:= Timing[ RandomReal[{}, {n, n}]; ]                                               
Out[4]= {1.164463, Null}

In[5]:= MaxMemoryUsed[]                                                                 
Out[5]= 1204929176

In[6]:= m=RandomReal[{}, {n, n}];                                                       

In[7]:= AbsoluteTiming[MatrixRank[m];]                                                  

Out[7]= {431.394567, Null}

In[8]:= MaxMemoryUsed[]                                                                 

Out[8]= 1204929176 
POSTED BY: Bruce Miller

$HistoryLength=0 and RandomReal[{} seems to have made big difference on memory. I re-run the test and got simliar CPU values as with v 9.01, but without the memory problem. I did not want to change the test since I used the same test before 2 times to compare with. But since this change only affected memory and not CPU which is what I am testing for, I can do that and still be fair to the other two programs I am comparing with.

Now Mathematica is again able to do n=7500 and n=8000 as it did in V9. Updated the test results.


POSTED BY: Nasser M. Abbasi

One can wrap the desired operations within a variety of *Constrained operations, where * might be Memory, Time, Pixel etc (on Mathematica 7).

MemoryConstrained[ some operation ]
POSTED BY: Isaac Abraham

Thanks, I know about these functions, but I was looking at something at the process level, so do not have to specific this each time for each command. Basically tell Mathematica Kernel itself, not to use more memory than some specific limit since in some large computation, one does not always know which operation will consume how much memory. I think this is a OS problem as well. I am really surprised that Windows allows any one process to just take as much memory as it wants with no restriction. But this is windows. I do not know how this behaves on Linux or the Mac.

POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract