Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Memory usage in Stata 11 and 12

From   "William Gould, StataCorp LP" <>
Subject   Re: st: Memory usage in Stata 11 and 12
Date   Fri, 29 Jul 2011 10:54:07 -0500

Roland Andersson <> wrote, 

> I [...]  upgraded my laptop [...]  from 2 GB to 3 GB RAM. However,
> this did not have any effect on the available memory for Stata11.
> [...]  I am using Windows XP 32-bit.  [...]
> Is there any utility for windows that can help me find a way to make
> more room for Stata? [...]
> [...] I wonder if Stata 12 is more efficient in memory usage? If I
> upgrade will I have more, or less, memory available for data, or does
> Stata still need uninterrupetd memoryblocks?

Windows XP will not allow a process to consume more than 2GB of
memory.  There are no utilities or tricks to get around XP's limit.
It is true that a 32-bit process can address 4gb, but in all 32-bit
Windows operating systems, 2gb is reserved for use by the operating

If you specify /3GB in the XP boot process, a process such as Stata
may use 3GB as its own address space, but that program has to be
compiled in a certain way to take advantage of that, and Stata is
not.  When we tested /3GB on a special compile, we got only 100mb more
memory, and we were concerned about possible side effects.

Stata 12 should allow Roland to get more memory than Stata 11
because Stata 12 allocates memory in blocks and that helps the
operating system.  In our experiments, Stata 11 could allocate rougly
1,200-1,300 MB and Stata 12 allocateed 1,600-1,700 MB.  Actual numbers
will vary according to other software installed on the system which
affects which DLLs are loaded into Stata's address space.

Nick Cox <> wrote, 

> [...] my impression is that there is no difference, as nothing in
> Stata 12 changes Windows, but I would want StataCorp to give the
> definitive statement on that.

Basically, what Nick's impression is correct, but there is a minor 
issue.  Stata 11 allocated memory for the data in one big block.  
Stata 12 allocates memory in multiple segments.  As a result, 
Stata 12 can succeed in allocating more total memory than Stata 11.
That can be important on 32-bit systems.  

If you are running a 32-bit operating system and cannot get 
around 1,700 MB, try reducing the segmentsize.  On 32-bit systems, 
the default segmentsize is 16m.  Type -query memory- to determine 
your current values of the memory tuning parameters. 

To reduce segmentsize to 8m, type 

	. set segmentsize 8m

That might help.  Reducing segment size reduces performance, but only 
slightly.  The effect of a factor of 2 reduction from the optimal value
is barely measureable.  I do not want to claim that segmentsize = 16m is
optimal for all 32-bit systems, but it is close to being optimal.

-- Bill             -- James Hassell          -- Hua Peng
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index