Re: memory issues

*To*: mathgroup at smc.vnet.net*Subject*: [mg68819] Re: memory issues*From*: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>*Date*: Sat, 19 Aug 2006 00:41:45 -0400 (EDT)*References*: <ec3pme$2a0$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, only a 32 bit operating system has the limit, that it can only address 4 GByte. But typical the operating system has some overhead to handle multiple applications ... Especial Windows XP 32 allow a bit less than 2 GByte per application. With a 64 operating system you can address 4 TByte ... but your 2 GByte RAM are far away from that limit. Mathematica can store so many data as the operating system allows, the operating system uses virtual memory and for an application it does not make a difference if the memory is in the RAM or in th swap file. It will only take longer time to handle the data from the swap file. Mathematica can't find out when the operating system starts using the swap file. Mathematica write *never* memory in the swap file -- your operating system does this ... Mathematica uses OpenMP to perform certain numerical computation in parallel and you have to set the environment variable OMP_NUM_THREADS=4 or what ever to tell Mathematica how many threads can be started parallel. Mathematica store integers as machine integers whenever it can. A machine integer on a 32 bit CPU can be 2^31 -1 (one bit for the sign), and that needs 4 bytes not 16, on a 64 bit CPU you can have long integers that store values up to 2^63-1 and these numbers need 8 byte and never 16. And in you example you have obvious 32 bit machine integers because 4 (bytes per integer)* 125000000==500000000 and you have a small overhead of 56 byte to store the array ... And > How should I estimate the memory limits in my algorithms, when > designing them on this basis? it seems the best to take a break and to think about some basic properties of the computer you are using and to read the manual of your operating system. Regards Jens Christoph Lhotka wrote: > Hi! > > Running Mathematica 5.2 on 64Bit (AMD) with 2GB of RAM Memory OS: WindowsXP 64 > Pro. I get the message: No more memory available. Mathematica Kernel has shut > down... > > How do I find out: > > 1) How much memory can Mathematica store in the RAM? > 2) How much memory can Mathematica store on the Hard disk (swap file)? > 3) At which memory limit does Mathematica begin writting to the had disk? > 3) Can I influence these limit 3) using the OS or in Mathematica? > 4) How do I find out at which point in the calculation the kernel stops? > 5) Why does my dual core processor does not work higher than with 50% > > Doing some tests on my own I got the following riddle: > > In[]:=ByteCount[1] > Out[]:=16 > > In[]:=2000000000/16 > Out[]:=125000000 > > In[]:=DAT=Table[i,{i,1,125000000}]; > > In[]:=ByteCount[DAT] > Out[]:=500000056 > > In[]:=MaxMemoryUsed[] > Out[]:= 502133312 > > Why is a list of 125 000 000 different integers (a 16 Byte) only 500 000 000 > Bytes long? How should I estimate the memory limits in my algorithms, when > designing them on this basis? > > Thank you in advance > > Christoph >