简体   繁体   English

如果在R中进行模拟后使用鼠标滚轮,Windows 7将无响应

[英]Windows 7 becomes unresponsive if mouse scroll wheel is used after a simulation in R

I am using R 3.0.2 in Windows 7 64 bit. 我在Windows 7 64位中使用R 3.0.2。 After running simulations with an output greater than about 100000 in length, if I use the mouse scroll wheel in the R console, Windows freezes indefinitely. 在运行长度大于约100000模拟后,如果我在R控制台中使用鼠标滚轮,Windows将无限期冻结。

I once left it sitting for over a week with no response. 我曾经让它坐了一个多星期没有回应。 Forcing shutdown is the only way out, and it does not register in Windows event log. 强制关闭是唯一的出路,它不会在Windows事件日志中注册。 I have tried to duplicate the issue in other programs, but it appears to occur only in R. I have tried several versions of R, uninstalled and reinstalled each, used several different computer mice and drivers, and even reinstalled Windows. 我试图在其他程序中复制该问题,但它似乎只在R中出现。我已经尝试了几个版本的R,每个都卸载并重新安装,使用了几个不同的计算机鼠标和驱动程序,甚至重新安装了Windows。 Nothing has fixed the issue. 什么都没有解决问题。

Some other common aspects that I can think of (but not yet certain are factors) are that 我能想到的其他一些共同方面(但尚未确定是因素)就是这样

  1. the simulations typically print iteration numbers, etc to the console during the simulation (using flush.console() for instance), and 模拟通常在模拟期间向控制台打印迭代次数等flush.console()例如使用flush.console() ),和

  2. memory use is high during (but not upon completion of) the simulation. 在模拟期间(但不是在完成时)内存使用很高。 Computer has 32GB RAM and two Intel Xeon E5-2687W CPUs (8-core, 3.1GHz). 计算机具有32GB RAM和两个Intel Xeon E5-2687W CPU(8核,3.1GHz)。

An example that might cause this issue for me is: 可能导致此问题的一个示例是:

    foo<-function(X, SD, N, sims){
    output<-vector("list")
    for(i in 1:sims){
        output[[i]]<-rnorm(N, X, SD)
        flush.console()
        cat(paste("Iteration", i, ":", "\n",
            "mean = ", round(mean(output[[i]]),1), "\n",
            "sd   = ", round(sd(output[[i]]), 1), "\n"))
    }
    return(output)
    }

    result<-foo(X=20, SD=2, N=100, sims=100) # but increase N or sims to > 100000

    # Now used the mouse scroll wheel in the R console.  Computer freezes.
    # Can also do rm(list=ls()) after the simulation, then use scroll wheel... Computer still freezes.

Your code runs smooth in my computer with both (Rgui.exe and Tinn-R + Rterm.exe). 您的代码在我的计算机上运行顺畅(Rgui.exe和Tinn-R + Rterm.exe)。

Windows 7 (64 bit) and R version 3.0.2 Patched (2013-10-08 r64039). Windows 7(64位)和R版本3.0.2已修补(2013-10-08 r64039)。

See the output below: 见下面的输出:

R version 3.0.2 Patched (2013-10-08 r64039) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R é um software livre e vem sem GARANTIA ALGUMA.
Você pode redistribuí-lo sob certas circunstâncias.
Digite 'license()' ou 'licence()' para detalhes de distribuição.

R é um projeto colaborativo com muitos contribuidores.
Digite 'contributors()' para obter mais informações e
'citation()' para saber como citar o R ou pacotes do R em publicações.

Digite 'demo()' para demonstrações, 'help()' para o sistema on-line de ajuda,
ou 'help.start()' para abrir o sistema de ajuda em HTML no seu navegador.
Digite 'q()' para sair do R.

> foo<-function(X, SD, N, sims){
+     output<-vector("list")
+     for(i in 1:sims){
+         output[[i]]<-rnorm(N, X, SD)
+         flush.console()
+         cat(paste("Iteration", i, ":", "\n",
+             "mean = ", round(mean(output[[i]]),1), "\n",
+             "sd   = ", round(sd(output[[i]]), 1), "\n"))
+     }
+     return(output)
+     }
> 
>     result<-foo(X=20, SD=2, N=100, sims=100) # but increase N or sims to > 100000
Iteration 1 : 
 mean =  20.1 
 sd   =  2 
Iteration 2 : 
 mean =  20 
 sd   =  2 
Iteration 3 : 
 mean =  19.9 
 sd   =  2 
Iteration 4 : 
 mean =  19.9 
 sd   =  1.9 
Iteration 5 : 
 mean =  19.5 
 sd   =  2.1 
Iteration 6 : 
 mean =  20 
 sd   =  2.2 
Iteration 7 : 
 mean =  20.2 
 sd   =  2.2 
Iteration 8 : 
 mean =  20 
 sd   =  1.8 
Iteration 9 : 
 mean =  19.5 
 sd   =  2 
Iteration 10 : 
 mean =  20.1 
 sd   =  2.1 
Iteration 11 : 
 mean =  19.8 
 sd   =  2 
Iteration 12 : 
 mean =  20 
 sd   =  2 
Iteration 13 : 
 mean =  20 
 sd   =  1.8 
Iteration 14 : 
 mean =  19.9 
 sd   =  1.8 
Iteration 15 : 
 mean =  20.2 
 sd   =  2 
Iteration 16 : 
 mean =  20.2 
 sd   =  1.8 
Iteration 17 : 
 mean =  20.5 
 sd   =  2.2 
Iteration 18 : 
 mean =  20 
 sd   =  1.9 
Iteration 19 : 
 mean =  19.8 
 sd   =  1.8 
Iteration 20 : 
 mean =  19.9 
 sd   =  2.2 
Iteration 21 : 
 mean =  20.2 
 sd   =  2 
Iteration 22 : 
 mean =  19.7 
 sd   =  1.8 
Iteration 23 : 
 mean =  19.8 
 sd   =  2 
Iteration 24 : 
 mean =  19.8 
 sd   =  1.9 
Iteration 25 : 
 mean =  19.9 
 sd   =  2.1 
Iteration 26 : 
 mean =  20.3 
 sd   =  2.1 
Iteration 27 : 
 mean =  19.6 
 sd   =  2 
Iteration 28 : 
 mean =  20 
 sd   =  2.1 
Iteration 29 : 
 mean =  20 
 sd   =  2.2 
Iteration 30 : 
 mean =  19.9 
 sd   =  1.7 
Iteration 31 : 
 mean =  19.9 
 sd   =  1.8 
Iteration 32 : 
 mean =  19.8 
 sd   =  1.9 
Iteration 33 : 
 mean =  20.1 
 sd   =  2.1 
Iteration 34 : 
 mean =  20.3 
 sd   =  2.2 
Iteration 35 : 
 mean =  20.2 
 sd   =  2 
Iteration 36 : 
 mean =  20.1 
 sd   =  2 
Iteration 37 : 
 mean =  19.8 
 sd   =  2.1 
Iteration 38 : 
 mean =  20 
 sd   =  2 
Iteration 39 : 
 mean =  20.1 
 sd   =  1.9 
Iteration 40 : 
 mean =  20.1 
 sd   =  2 
Iteration 41 : 
 mean =  19.8 
 sd   =  2.1 
Iteration 42 : 
 mean =  19.9 
 sd   =  2 
Iteration 43 : 
 mean =  19.8 
 sd   =  1.8 
Iteration 44 : 
 mean =  20.1 
 sd   =  1.7 
Iteration 45 : 
 mean =  20.1 
 sd   =  1.8 
Iteration 46 : 
 mean =  20.1 
 sd   =  1.9 
Iteration 47 : 
 mean =  20 
 sd   =  2.2 
Iteration 48 : 
 mean =  19.8 
 sd   =  1.9 
Iteration 49 : 
 mean =  19.9 
 sd   =  2.1 
Iteration 50 : 
 mean =  19.7 
 sd   =  2 
Iteration 51 : 
 mean =  19.9 
 sd   =  2 
Iteration 52 : 
 mean =  20.5 
 sd   =  2 
Iteration 53 : 
 mean =  20 
 sd   =  2 
Iteration 54 : 
 mean =  20.3 
 sd   =  1.9 
Iteration 55 : 
 mean =  19.9 
 sd   =  1.9 
Iteration 56 : 
 mean =  20.1 
 sd   =  2.1 
Iteration 57 : 
 mean =  20.3 
 sd   =  2.2 
Iteration 58 : 
 mean =  19.8 
 sd   =  2.3 
Iteration 59 : 
 mean =  20.2 
 sd   =  2 
Iteration 60 : 
 mean =  19.6 
 sd   =  2.1 
Iteration 61 : 
 mean =  19.9 
 sd   =  1.9 
Iteration 62 : 
 mean =  20.1 
 sd   =  1.9 
Iteration 63 : 
 mean =  20.1 
 sd   =  2.3 
Iteration 64 : 
 mean =  19.8 
 sd   =  2.1 
Iteration 65 : 
 mean =  20 
 sd   =  2 
Iteration 66 : 
 mean =  19.7 
 sd   =  1.9 
Iteration 67 : 
 mean =  20.1 
 sd   =  2.1 
Iteration 68 : 
 mean =  20.2 
 sd   =  2 
Iteration 69 : 
 mean =  20.1 
 sd   =  2 
Iteration 70 : 
 mean =  20.2 
 sd   =  2.1 
Iteration 71 : 
 mean =  20.1 
 sd   =  2 
Iteration 72 : 
 mean =  20.2 
 sd   =  2.1 
Iteration 73 : 
 mean =  20.1 
 sd   =  2 
Iteration 74 : 
 mean =  20 
 sd   =  2 
Iteration 75 : 
 mean =  19.8 
 sd   =  2.2 
Iteration 76 : 
 mean =  20.1 
 sd   =  2.2 
Iteration 77 : 
 mean =  20.2 
 sd   =  1.5 
Iteration 78 : 
 mean =  20.1 
 sd   =  2.2 
Iteration 79 : 
 mean =  20.2 
 sd   =  2.1 
Iteration 80 : 
 mean =  20.1 
 sd   =  2.1 
Iteration 81 : 
 mean =  20 
 sd   =  1.8 
Iteration 82 : 
 mean =  20.4 
 sd   =  2.1 
Iteration 83 : 
 mean =  20.1 
 sd   =  1.9 
Iteration 84 : 
 mean =  20.1 
 sd   =  2.1 
Iteration 85 : 
 mean =  20.2 
 sd   =  2 
Iteration 86 : 
 mean =  19.8 
 sd   =  2.1 
Iteration 87 : 
 mean =  20.1 
 sd   =  2 
Iteration 88 : 
 mean =  19.9 
 sd   =  2.1 
Iteration 89 : 
 mean =  20 
 sd   =  1.9 
Iteration 90 : 
 mean =  19.8 
 sd   =  2.2 
Iteration 91 : 
 mean =  19.9 
 sd   =  2 
Iteration 92 : 
 mean =  20 
 sd   =  2 
Iteration 93 : 
 mean =  19.9 
 sd   =  2.2 
Iteration 94 : 
 mean =  19.8 
 sd   =  1.8 
Iteration 95 : 
 mean =  19.7 
 sd   =  1.8 
Iteration 96 : 
 mean =  20.6 
 sd   =  1.8 
Iteration 97 : 
 mean =  20.1 
 sd   =  2 
Iteration 98 : 
 mean =  19.8 
 sd   =  1.9 
Iteration 99 : 
 mean =  19.9 
 sd   =  1.9 
Iteration 100 : 
 mean =  19.8 
 sd   =  1.8 
> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM