Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Commented Unassigned: Access Violation Exception after extended run of t.test loop [43]

$
0
0
My code runs just fine with one data set but fails at the same point each time a different data set is run. Two different arrays are created in a loop through a large data set using "engine.CreateNumericVector(arGroup1Intensities)" and "engine.CreateNumericVector(arGroup2Intensities)". The data sets are comprised of 207 and 623 members (doubles), respectively. After 223 iterations, I get an error "attempted to read or write protected memory." After going back and checking, it appears that the first array was created fine (207 members), but was reduced to just 1 member when the second array was created. Any suggestions how to fix this?

The "engine" is an REngine that is created at the top of the loop with "using (REngine engine = REngine.CreateInstance("Test")". The creation and checking of arrays is accomplish within the loop with:

vGroup1 = engine.CreateNumericVector(arGroup1Intensities);
Console.WriteLine(vGroup1.Length);
vGroup2 = engine.CreateNumericVector(arGroup2Intensities);
Console.WriteLine(vGroup2.Length);
engine.SetSymbol("group1", vGroup1);
engine.SetSymbol("group2", vGroup2);
GenericVector testResult = engine.Evaluate("t.test(group1, group2)").AsList();

Comments: Hi, If I follow what you say, at some point in an iteration (after 223 T-tests), after a call to ``` vGroup2 = engine.CreateNumericVector(arGroup2Intensities); ``` if you call the following, you see '1' instead of '207' ``` Console.WriteLine(vGroup1.Length); ``` This does sound like a garbage collection occuring in the R world, but I am far from 100% confident in my understanding of the R internals. Would you be able to give a small-ish program plus data reproducing the issue? I did not quite get the scope and size of the data you are dealing with. You may have also some data privacy/licensing issues preventing from giving more details. Regards

Viewing all articles
Browse latest Browse all 1634

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>