I believe AndersonDarlingTest
and probably all other tests are keeping a copy of data somewhere and not freeing it:
Quit[]; (*Must be run in different cell*)
$HistoryLength = 0;
memdata = {{MemoryInUse[], MaxMemoryUsed[]}}~Join~Table[
data =
RandomVariate[
MultinormalDistribution[{0, 0}, {{1, 1/2}, {1/2, 2}}], 1000000];
dist = MultinormalDistribution[{ux, uy}, {{a, c}, {c, b}}];
AndersonDarlingTest[data,
dist, {"FittedDistributionParameters", "PValue"}];
Clear@data; Clear@dist;
ClearSystemCache[];
{MemoryInUse[], MaxMemoryUsed[]}
, {10}]/1024.^2;
ListPlot[Transpose@memdata, Joined -> True,
PlotLegends -> Placed[{"MemoryInUse", "MaxMemoryUsed"}, Top],
AxesLabel -> {"Iteration", "Memory (MB)"}]
Questions:
- Am I missing something obvious or is this a bug? Just want to make sure before I report it...
- Is there a work around? I've been spelunking with the excellent spelunking package, but so far no luck...
Heavy symbols gives some candidates, but clearing the symbols in the loop gives me various errors.
heavySymbols["Statistics`*`"]
{"Statistics`GoodnessOfFitTestingDump`iHypothesisTestFunction",
"Statistics`StableEstimationDump`iLogPDF17",
"Statistics`StableEstimationDump`iPDF05b1"}
Using MMA 9.0.1 on Win7 64 bit.
Comments
Post a Comment