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: diagnose stata memory usage

From   Nick Sanders <>
Subject   Re: st: diagnose stata memory usage
Date   Tue, 28 Dec 2010 10:14:51 -0800

Hi Andrea,

> I am using Stata/SE 11.0 on Windows XP SP3 32 bit and sometimes my
> do-files end with "op sys refuses to give memory" even on very small
> dataset.

I've had this problem in the past when working on a shared server. Despite the fact that there was well over several gigs of memory available, Stata would crash out with the "op sys refuses to give memory" or "op sys refuses to start new process" error. Are you trying to execute any shell processes within Stata? That is to say, are you doing things like "shell gunzip foo.dta.gz"? It was always shell commands that gave me issues.

Another possibility is that the command you are running requires a lot more space than the data itself. For example, "xtivreg2"  takes up a good chunk of memory beyond that of the data set itself. 

A more nitty-gritty step is to use "set trace on". That makes Stata display the "background" commands it's running to do each task. You then can use "set tracedepth" to see how in depth you would like to see (try "help trace" for more info). Be warned, you'll get a LOT of output in your log files, but at least you'll be able to see exactly where the memory constraint hits.  

What command is finally sending your do file over the edge?


Nicholas J. Sanders, Ph.D.
Postdoctoral Fellow
Stanford Institute for Economic Policy Research
366 Galvez St, Room 228
Stanford, CA 94305

*   For searches and help try:

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