Uncontrolled memory consumption for synchrotron radiation

Issue #36 resolved
Stewart Boogert created an issue

Running with ~1k samplers and lots of secondary particles there seems to be an uncontrolled memory consumption. ROOT as the sampler trees are being filled should flush the event from memory to disk, but this does no appear to be happening.

Attached are ILC filed that create the problem

Comments (7)

  1. Laurie Nevay

    Hmmm.

    Could be in sd class. Should be only one sd class. But only thing that's had big changes recently. Oh and I guess output. Maybe output or analysis manager.

    I guess you'll find! Sorry if it was me!

    Cheers, Laurie

  2. Jochem Snuverink

    this happens due to secondary photon production in BDSSynchrotronRadiation.cc. Not sure why the secondaries memory is not released after each event again, but there are no memory leaks and can't see anything wrong with the code. Will debug further once Geant4 compilation with debug info is finished.

  3. Jochem Snuverink

    fixed in develop branch.

    Only half (rounded up) of the secondaries were added to the track. Silly mistake in for-loop:

    for(unsigned int n=0;n<listOfSecondaries.size();n++){ aParticleChange.AddSecondary(listOfSecondaries.front()); listOfSecondaries.pop_front(); }

    the size of the list (actually a std::deque) decreased in the loop, resulting in only half of the list being accessed.

    The not-added secondaries were lost, but somehow this potential memory leak didn't show in valgrind. I guess due to magical Geant4 garbage collection.

  4. Log in to comment