11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6.3 Setting memory size on the fly: Stata/IC[ U ] 6.4 The memory command 65You can reallocate memory on the fly. Assume you have changed nothing about how Stata starts,so you get the default 10 megabytes of memory allocated to Stata’s data areas. You are working witha large dataset and now wish to increase it to 32 megabytes. You can type. set memory 32m(32768k)and, if your operating system can provide the memory to Stata, Stata will work with the new total.Later in the session, if you want to release that memory and work with only 2 megabytes, you couldtype. set memory 2m(2048k)There is only one restriction on the set memory command: whenever you change the total, therecannot be any data already in memory. If you have a dataset in memory, save it, clear memory, resetthe total, and then use it again. We are getting ahead of ourselves, but you might type. save mydata, replacefile mydata.dta saved. clear. set memory 32m(32768k). use mydataWhen you request the new allocation, your operating system might refuse to provide it:. set memory 512mop. sys. refuses to provide memoryr(909);If that happens, you are going to have to take the matter up with your operating system. In the aboveexample, Stata asked for 512 megabytes and the operating system said no.For most 32-bit computers, the absolute maximum amount of memory that can theoretically beallocated will be approximately 2 (32−1) bytes (2 gigabytes), regardless of the operating system. Inpractice, the amount of memory available to any one application on a system is affected by manyfactors and may be somewhat less than the theoretical maximum.Sixty-four bit computers can theoretically have up to 2 (64−1) bytes (more than 2 billion gigabytes).In practice, 64-bit computers will have as much memory as is affordable. We are aware of sites usingStata with datasets consuming more than 10 gigabytes of memory.6.4 The memory commandmemory helps you figure out whether you have sufficient memory to do something.(Continued on next page)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!