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

Re: st: RE: Re: OS memory availability

From   Fred Wolfe <[email protected]>
To   [email protected], <[email protected]>
Subject   Re: st: RE: Re: OS memory availability
Date   Wed, 31 Mar 2004 04:48:00 -0600

Using systeminfo my machine reports
Total physical memory: 2047
Available physical memory: 1405

However, Stata refuse to set mem until 1100m:

. set mem 1400m
op. sys. refuses to provide memory

. set mem 1300m
op. sys. refuses to provide memory

. set mem 1200m
op. sys. refuses to provide memory

. set mem 1100m

This is the number allowed by the following updated program:

*! 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

which produces the following output:

. memtest
Maximum value of memory allowed by OS is 1100m

Current memory allocation

current memory usage
settable value description (1M = 1024k)
set maxvar 5000 max. variables allowed 1.733M
set memory 1100M max. data space 1,100.000M
set matsize 800 max. RHS vars in models 4.950M

. return list

r(osmem_m) = 1100


At 04:17 PM 3/30/2004, Nick Cox wrote:

I built a bit on Kevin's useful idea.
If you don't see the downside of this
program, don't use it. If you want to
build on it, feel free.

program systeminfo
  version 8
  tempfile file
  shell systeminfo /FO CSV > `file'
  qui insheet using `"`file'"', comma

  foreach v of var * {
    di as txt `v'[1] ": " `v'[2]

[email protected]

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Kevin Turner
> Sent: 30 March 2004 22:40
> To: [email protected]
> Subject: st: Re: OS memory availability
> Fred Wolfe <[email protected]> writes:
> >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.
> Like Fred, I've placed -set mem- inside of a for loop and
> captured the highest
> value that Stata can successfully allocate. I don't know if
> there is a way to
> obtain the highest value apart from experimentation because
> the value is
> not guaranteed to be constant over time. The reason for this
> is that, on
> Windows, it represents the largest _continuous_ free block of
> memory. As
> programs request and free up portions of memory, this space
> can potentially
> change in size.
> However, if you want to dynamically find the amount of
> physical memory (like
> David was asking) you can get this value using a DOS command.
> From Stata:
> . shell systeminfo /FO CSV > systeminfo.csv
> . insheet using systeminfo.csv, comma
> This imports a dataset with various system specifications. The first
> observation contains all the variable names and the second
> observation contains
> their values. Get the values you want and then clear the dataset.
> To prevent thrashing of virtual memory, stay at or below the
> value in v23 and
> make sure that Stata is not competing for memory resources
> with another
> running program.
> . list v23 in 2
> Hope this helps,
> --Kevin
> [email protected]
> *
> *   For searches and help try:
> *
> *
> *

*   For searches and help try:

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

*   For searches and help try:

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