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

st: size aware memory allocation when opening files


From   "Dr Kardos Laszlo" <[email protected]>
To   <[email protected]>
Subject   st: size aware memory allocation when opening files
Date   Thu, 11 Jul 2002 15:01:15 +0200

Dear Statalisters,

oddly, this is not a question but an unprovoked answer. There is a simple
solution, not based on profile.do, to make sure the right amount of memory,
calculated from the actual file size, is automatically allocated when you
double click a .dta file. That way you will never get the insufficient
memory error message (subject to your hardware limitations, "op. sys
refuses..." still might come up of course), but will still avoid
unnecessarily big memory allocation for small files.

I did not find this in the manual or in the FAQ, and as it has saved me
extra typing and trouble, I thought at least some users might benefit if I
share this. Other or similar ways to do the same might be around, sorry if I
should be re-stating the obvious.

Here is how it goes:

1. put a file memopen.do in your stata7\data folder with these lines:

args filename
d using `filename'
local setmem=int((r(width)+4)*r(N)*0.0015)
if `setmem'>10000 {set mem `setmem'}
u `filename'


2. Change the "open" action of the "Stata Dataset" file type to
"C:\Program files\Stata7\wstata.exe" /m10 run "C:\Program
files\Stata7\data\memopen" "%1"


You do this by opening any folder, then view -- folder options -- file
types -- select Stata Dataset -- edit -- select open from the actions
list -- edit

Substitute your own installation path if different than mine.


3. notes: tweak to you own preference by changing the "*0.0015" and ">10000"
bits in the do file and the /m10 option in the command line. These settings
will set your memory 10 megs with small files and about 150% of file size
with large files.

Laszlo


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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