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

Commented Issue: 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: Need to capture as unit test to close the issue.

Viewing all articles
Browse latest Browse all 1634

Trending Articles