Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: OS memory availability

From   Fred Wolfe <>
Subject   Re: st: OS memory availability
Date   Tue, 30 Mar 2004 14:23:42 -0600

Thanks for the comments. I wrote the following program to try to get at the issue. It reports back the level of memory that does not get an "op. sys. refuses to provide memory" error.

*! memtest.ado v1.0.0 fw 3/30/04 determines maximum allowable memory
*! and current memory. Allowable value is passed on in local memtest
*! keywords: memory
program define memtest
version 8.2
qui query memory
local oldmem = `r(memory)'
local memtest = 2000
while `memtest' > 100 {
cap set mem `memtest'm
*di "`memtest' " _rc
if _rc == 0 {
di in green "Maximum value of memory allowed by OS is " in yellow"`memtest'm"
continue, break
local memtest = `memtest' - 100
* di "`oldmem'"
set mem `oldmem'k


At 01:18 PM 3/30/2004, you wrote:

Regarding Fred Wolfe's question:

I don't know, and I wish I did know.

I have been in the situation of wanting to know how much memory I can request, without going in to virtual memory -- so as to handle a large dataset without the significant slowdown of virtual memory . I suspect that this is what you are looking for.

From just experimentation, I have found that with 256mb of real memory, I can request about 230mb -- maybe as much as 234mb -- before invoking virtual memory. That's about 90% of real memory. (And the only way I know that I am using virtual memory is by the obvious slowing and all the disk activity.)

This may depend on what else is running and maybe what has recently been running. It helps if no other programs are running; it may also help if you reboot just before starting your run (maybe).

I'm curious to learn what others have to say.
-- David

At 12:49 PM 3/30/2004 -0600, you wrote:

Does anyone know how to dynamically obtain the amount of memory Windows 2000 or XP Pro has available? The goal is to set mem in Stata based on the OS availability?


Ferd Wolfe

* For searches and help try:
David Kantor
Institute for Policy Studies
Johns Hopkins University

*   For searches and help try:

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel (316) 263-2125     Fax (316) 263-0761

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index