RooAbsPdf::generate segfault with 2d pdfs after many trials


I am trying to use a two-dimensional RooHistPdf to generate a lot of toy MC, but run into a reproducible segfault in calling RooAbsPdf::generate a large number of times. Here is a snippet of the backtrace:

I have attached an example macro which I run compiled to produce this behavior. Some notes about the example:

  1. It’s a proof-of-concept code designed in the spirit of the actual analysis code I’m writing. In the analysis code I am looking at likelihood differences between pdfs as a function of number of events.
  2. It takes a long time for the segfault to occur, roughly 70 minutes with one core on my machine, so please be patient if you care to test it. For me the crash occurs somewhere between the 33000’th and 34000’th call to generate. I’m hoping the backtrace and macro alone are enough for an expert to tell me what I’m doing wrong.
  3. The backtrace is not suggestive of a memory problem, and besides my job died at 242MB on a machine with >>242MB.

This was all done on a 64bit linux machine with ROOT v5.27/06, though I first ran into the problem in 5.26.x.

Any help appreciated,

hist2dgenerate.C (1.6 KB)

Hi Jake,

Thanks for posting the example job, I’ll give it a try and let it run till it crashes.