SPlot memory usage

Hi experts,
There is a problem in the SPlot::AddSWeight method which fills up the memory.
You will recognize it if you run over huge amount of events, then your program could crash, due to memory limit on your system, or will be very slow due to swapping.
I found the following solution:

The call in the Loop:

  for (Int_t ievt = 0; ievt <numevents; ++ievt)
    {
      RooStats::SetParameters(fSData->get(ievt),pdf->getVariables() );
      ....

I changed to be defined outside the loop:

  RooArgSet *args=pdf->getVariables();
  for (Int_t ievt = 0; ievt <numevents; ++ievt)
    {
       RooStats::SetParameters(fSData->get(ievt),args );
       .....

The memory decreased from 4GB to below 1GB in my case.
I did not validate yet if it gives exactly the same results.
Can somebody comment on this or try it out.
And maybe put it in the next release if this is a not known issue.

Thanks in Advance,
Andreas

I put a bug report on savanna:https://savannah.cern.ch/bugs/?99400, but did not get a reply yet.
I know that many other people experienced the same problem with large datasamples reaching the memory limit.
It would be great if somebody could reply!

Cheers,
Andreas