Std::bad_alloce rror using 5 RooSetvariables in RooMCStudy

Hi all,

When I use the RooMCStudy for 5-Dimension I get the following error:

[#0] PROGRESS:Generation – RooMCStudy::run: sample 0
terminate called after throwing an instance of 'std::bad_alloc’
what(): std::bad_alloc

If I use RooArgSet<5, so 4 Variables it does work.
Any ideas?

Thanks in advance,


Hi Barabara,

It is probably because you have run out of memory to allocate, see this forum .

You can stop this by allocating memory efficiently, and deleting anything you declared with the keyword “new” once it is not being used. I assume you are doing a fit in the same routine before the RooMCStudy where you have allocated a lot of memory and not freed it again, but perhaps you could post some code so that it is possible to see if this really is the problem?



Hi esmith,

I did the toy.C as one of the tutorial macros. You can see it on the attachment.signalfit is the PDF and BckAngles is just Chebychev polynomials all fixed.

Is this clear of should I post more lines of code maybe?

Thanks a lot!