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

st: Mata and memory


From   "Jann, Ben" <[email protected]>
To   <[email protected]>
Subject   st: Mata and memory
Date   Tue, 10 May 2005 11:55:23 +0200

Hi, 

I have a problem with Mata that confuses me. Mata sometimes
issues an error

 "cannot create <istmt1>():  insufficient memory"

although I am not doing anything that really uses a lot of 
memory. Here's an example:

 . local list
 . forv i=1/10000 {
   2. local list "`list' hellobello"
   3. }
 . something `list'
 cannot create <istmt1>():  insufficient memory
 r(3000);

The -something- command is just for illustration and 
doesn't do anything complicated. It passes `list' 
through Mata and returns it in r() (find the code 
below).

The string containing 10000 times "hellobello" consumes
arround 110kb. How can this be a problem? 

Does the 110kb local macro plug up some cache that is 
used by Mata? How can this be prevented?

Many thanks for any help,
ben

PS: I'm using Stata/SE 9.0 on Windows XP

=== something.ado ===
program define something, rclass
	version 9.0
	syntax anything
	mata: something(`"`anything'"')
	return local list `"`r(anything)'"'
end

version 9.0
mata:
function something(string scalar anything)
{
	st_global("r(anything)", anything)
}
end
====================

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