Because I did not receive an acknowledgement of my e-mail from the StataCorp technical support team, I post the problem here again. Maybe someone else can replicate it.
I noticed that occassionally Stata 15.1 reserves more and more RAM which eventually lets my Windows 10 operating system crash (black screen). I can replicate the problem with a Monte Carlo simulation based on the code below. (WARNING: Executing this code might crash your computer and might lead to the loss of unsaved data!) Already after a few reps Stata 15.1 consumes almost all of my 16 GB RAM. The same code runs smoothly without any problem in Stata 14.2. (It does not seem to be a specific problem of the simulate command, as it just happened to me again in a different situation which I cannot replicate. Instead, it might be related to Mata's optimize() and moptimize() routines which I am using frequently, for example inside my xtdpdgmm program.)
Stata version information:
I noticed that occassionally Stata 15.1 reserves more and more RAM which eventually lets my Windows 10 operating system crash (black screen). I can replicate the problem with a Monte Carlo simulation based on the code below. (WARNING: Executing this code might crash your computer and might lead to the loss of unsaved data!) Already after a few reps Stata 15.1 consumes almost all of my 16 GB RAM. The same code runs smoothly without any problem in Stata 14.2. (It does not seem to be a specific problem of the simulate command, as it just happened to me again in a different situation which I cannot replicate. Instead, it might be related to Mata's optimize() and moptimize() routines which I am using frequently, for example inside my xtdpdgmm program.)
Code:
ssc install xtdpdgmm program define xtdpdgmm_simul, rclass version 14.2 syntax , [AR(real 0.8) T(integer 6) N(integer 100)] *--------------------------------------------------* *** data generation *** drop _all loc obs = (`t' + 1) * `n' // number of observations set obs `obs' egen int id = seq(), b(`= `t' + 1') // panel identifier egen byte time = seq(), f(0) t(`t') // time identifier mata: xtdpdgmm_simul_rgen(`ar', `t', `n') // random-number generation xtset id time *--------------------------------------------------* *** GMM estimation *** xtdpdgmm y L.y x, noser two vce(r) gmm(y, lag(2 6) c m(d)) gmm(x, lag(0 4) c m(d)) tempname b mat `b' = e(b) loc b_y = el(`b', 1, 1) *--------------------------------------------------* *** simulation results *** eret clear drop _all mata: mata drop xtdpdgmm_opt1_1 xtdpdgmm_opt2_1 ret sca b_y = `b_y' end version 14.2 mata: mata set matastrict off // random-number generation void xtdpdgmm_simul_rgen(real scalar ar, real scalar T, real scalar N) { // pseudo-random number generation u = rnormal(T, N, 0, sqrt(1 - ar^2)) e = rnormal(T, N, 0, sqrt(1 - ar^2)) a = rnormal(1, N, 0, 1) // initialization X = J(1, N, 0) Y = J(1, N, 0) // data-generating process for (t = 1; t <= T; t++) { xt = ar * X[t, .] + e[t, .] yt = ar * Y[t, .] + sqrt(1 - ar^2) * xt + a + u[t, .] X = (X \ xt) Y = (Y \ yt) } // variable generation var1 = st_addvar("double", "y") var2 = st_addvar("double", "x") st_store((1, (1 + T) * N), var1, vec(Y[|1, 1 \ (1 + T), N|])) st_store((1, (1 + T) * N), var2, vec(X[|1, 1 \ (1 + T), N|])) } end simulate, seed(33820) r(500) nol: xtdpdgmm_simul
Code:
. about Stata/SE 15.1 for Windows (64-bit x86-64) Revision 08 May 2018 Copyright 1985-2017 StataCorp LLC Total physical memory: 16628560 KB Available physical memory: 13277124 KB
Comment