Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: set mem

From   Fred Wolfe <>
Subject   Re: st: set mem
Date   Wed, 08 Mar 2006 16:55:52 -0600

At 04:42 PM 3/8/2006, you wrote:
I have found discrepancies on the maximum memory
allowed using the set mem command despite equal
amounts of RAM on various computers. Is there is a
direct correlation between RAM on your computer and
the memory allocated using the set mem command?

Any recommendations on how to maximize set mem?

I have a program that tests how much memory is available. I have not sent it SSC. It is posted below.

I have a few other programs, though not necessarily the most modern that do some useful things for memory.

One is called -resetmem- that allows you to reset memory without clearing out current memory. It also will reduce memory automatically so as not to waste memory. If there is some interest in it I can send it to Kit to post on the archives.

Bill Gould, who knows so many things, thinks programs like this are a bad idea because if something goes wrong you can lose your data. But that's true with many programs. I've never had a problem. Caveat ...


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

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–2020 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index