Skip to content

Cling JIT out-of-memory error when using large number of expression-based NormFactors #21052

@tianzhuli2002

Description

@tianzhuli2002

Check duplicate issues.

  • Checked for duplicates

Description

Hello,

We are encountering a reproducible out-of-memory error in ROOT when creating a large number of expression-based parameters during RooFit workspace construction.

Similar issues:
#14156
https://root-forum.cern.ch/t/cling-jit-session-error-cannot-allocate-memory/56744

As a stress test, we programmatically create many parameters defined via expressions (schematically of the form):

define a base parameter SF_i

define a derived parameter SquaredSF_i = SF_i * SF_i

Each derived parameter is implemented as a RooFit expression (e.g. via RooFormulaVar / expression factories), and all are inserted into a single workspace.

When scaling this up to O(10⁴–10⁵) such expression-based parameters (≈30,000 in our test), the job crashes during workspace creation with:

cling JIT session error: Cannot allocate memory
LLVM ERROR: out of memory

Our practical use case is a large simultaneous likelihood fit with many regions and samples, where custom normalisation scale factors are defined through algebraic expressions and applied consistently across subsets of regions and samples. In our real configuration, this corresponds to:

O(500) regions

O(4000) samples

O(70) expression-based scale factors (slightly more complex than a simple square)

While we do not require O(30,000) such expressions in production, we observe that the job already crashes reliably at this realistic scale, with the same Cling JIT out-of-memory failure. Reducing the number of expression-based scale factors to ~10–20 makes the problem disappear, even with the same regions and samples.

Reproducer

To run:

root -l
.L cling_test.C+

cling_test(30000)

cling_test.C

ROOT version

ROOT 6.37.01

Installation method

~/miniforge3/bin/root

Operating system

Platform: linuxx8664gcc

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions