Skip to content

Again investigate memory problems with k_order_perturbation on Windows

Two users at https://forum.dynare.org/t/cant-work-with-third-order/10523/12 report problems with Dynare 4.5.1. I cannot replicate the issue on my machine.

The stack trace on both affected machines is

Register State (from fault):
  RAX = 0000000000000000  RBX = 0000000000000000
  RCX = 00000000000000c4  RDX = 0000000000000000
  RSP = 000000012c03fe20  RBP = 000000012c03fed8
  RSI = 0000000000000000  RDI = 0000000006032530
 
   R8 = 000000012c03fdf8   R9 = 000000012c03fed8
  R10 = 0000000000000000  R11 = 0000000000000206
  R12 = 0000000000000000  R13 = 0000000000000000
  R14 = 0000000000000000  R15 = 0000000000000000
 
  RIP = 000000002911f5c7  EFL = 00010202
 
   CS = 0033   FS = 0053   GS = 002b

Stack Trace (from fault):
[  0] 0x000000002911f5c7 C:\dynare\4.5.1\mex\matlab\win64-7.8-9.2\k_order_perturbation.mexw64+00390599 mexFunction+00384471
[  1] 0x00000000290eca69 C:\dynare\4.5.1\mex\matlab\win64-7.8-9.2\k_order_perturbation.mexw64+00182889 mexFunction+00176761
[  2] 0x0000000029120cc4 C:\dynare\4.5.1\mex\matlab\win64-7.8-9.2\k_order_perturbation.mexw64+00396484 mexFunction+00390356
[  3] 0x000007feff08415f                     C:\Windows\system32\msvcrt.dll+00016735 srand+00000147
[  4] 0x000007feff086ebd                     C:\Windows\system32\msvcrt.dll+00028349 ftime64_s+00000477
[  5] 0x0000000076a659cd                   C:\Windows\system32\kernel32.dll+00088525 BaseThreadInitThunk+00000013
[  6] 0x000000007717a561                      C:\Windows\SYSTEM32\ntdll.dll+00173409 RtlUserThreadStart+00000033

So it might have to do with Visual Studies's msvcrt.dll and the random number generator's call to the system time.