Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: -set memory- in Stata 11


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: -set memory- in Stata 11
Date   Mon, 27 Jul 2009 15:06:03 -0500

Roger Newson <[email protected]> is using Stata 11, and has some
do-files that call -set memory- after -clear- while Stata matrices are still in
memory:

> Thanks to all at StataCorp for the new Stata 11, which I am currently
> testing (in its IC flavor) on my Windows XP system, and which seems to be
> working as advertized so far.

> One immediate query (sorry for being a pest). Is there any special reason
> why, in Stata 11, we can no longer reset the memory using -set memory- when
> there is a set of estimation results (or even a matrix) in the memory, even
> under version control with the command -version 10.1-? (I have included a
> demonstration of this feature of Stata 11 under version control below my
> signature.)

> I ask because we were always allowed to do this in Stata 6, 7, 8, 9 and 10,
> and I have therefore always habitually started most of my do-files with
> three commands, which were a -version- command, a -clear- command, and a
> -set memory- command. As in:

> version 10.1;
> clear;
> set memory 1m;

> These do-files worked under their respective Stata versions, or under higher
> versions. However, if I re-run a Stata 10.1 do-file beginning with these 3
> commands under Stata 11, and a set of estimation results (or a matrix)
> already exists in the memory, then the first 2 commands execute OK, but the
> third command aborts with the error message

> no; Stata matrices have not been cleared
> (type -clear matrix- to clear Stata matrices)

> I am aware that, if I amend the second of the above 3 commands so that they
> read

> version 10.1;
> clear all;
> set memory 1m;

> then the matrices will be cleared as well, and the do-file will therefore
> run under either Stata 10.1 or Stata 11. However, I was wondering if there
> is a quick fix to this minor teething problem which does not require me to
> edit most of my existing currently active do-files one by one. I cannot
> immediately find such a fix in the on-line help for -clear- or -memory-, or
> in the new .pdf manuals (which are a much appreciated improvement - thanks
> to all at StataCorp).

In Stata 11, matrix column/row names were updated to handle the new
factor variables notation, thus their data-structures are much more dynamic
than before.  Because of this we were faced with two competing issues:

1.  The new matrix column/row names could fragment memory making it difficult
for Stata to allocate the memory requested in a call to -set memory-.

2.  We don't want -clear- to just remove all matrices from memory because that
would result in a loss of all the estimation results currently in memory.

Thus we elected to have -set memory- complain if it found any matrices
currently stored in memory, just like it complains if there is any data or
Mata objects left in memory.

Roger has discovered the best solution by using -clear all- at the top of his
do-files.

In fact, in Stata 9 and earlier and thus under version control, -clear- is
essentially the same as the modern -clear all-.  Thus, Roger should not need
to change any of his do-files from the Stata 9 days or earlier.

--Jeff
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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