# Multi-threading RAM issue

**URL:** <https://geant4-forum.web.cern.ch/t/multi-threading-ram-issue/1953>\
**Category:** Recording, Visualizing and Persisting Data\
**Created:** [February 25, 2020, 4:18am UTC](https://geant4-forum.web.cern.ch/t/multi-threading-ram-issue/1953 "2020-02-25T04:18:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jiho](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/jiho/32/674_2.png) [@Jiho](https://geant4-forum.web.cern.ch/u/Jiho)\
**Post date:** [February 25, 2020, 4:18am UTC](https://geant4-forum.web.cern.ch/t/multi-threading-ram-issue/1953/1 "2020-02-25T04:18:31Z")

</div>

Hi, I’m trying to use multi-threading with GEANT4. I convert all of my files and it built well without a crash.

But when I tried to give a [/run/beamOn 2500], it stops.  
I can’t understansd this phenomenon. Since my original program, using G4RunManager not a G4MTRunManager, successfully did the same order I gave.

For the multi-threading, I made my main.cc like this.  
– main.cc –  
G4MTRunManager\* runManager = new G4MTRunManager;  
runManager -\> SetNumberOfThreads(4);  
…  
…  
– end of main.cc –  
Also I used following source codes in src folder

- ActionInitialization.cc
- DetectorConstruction.cc
- PrimaryGeneratorAction.cc
- RunAction.cc
- SteppingAction.cc

For the malfunction, the whole CPU cores are running about 30-40%, and RAM usages are continuously increased to 100% and stops.

I want to use it multi-threading condition to give 100,000 or over incident beams.  
Is my system’s RAM is not sufficient for the GEANT4? I’ll give a specific information of my system below. Or is there are any missing part?

– System’s specification –  
Ubuntu 18.04.3, 64bit  
GEANT4 10.06  
32GB RAM  
Intel Core i7-8700 (6 Core 12 Thread)  
GeForce GTX 1060 6GB

---

<div class="post-metadata">

**Author:** ![asaim](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/a/848f3c/32.png) [@asaim](https://geant4-forum.web.cern.ch/u/asaim)\
**Post date:** [February 25, 2020, 6:11am UTC](https://geant4-forum.web.cern.ch/t/multi-threading-ram-issue/1953/2 "2020-02-25T06:11:12Z")

</div>

Your symptom indicates memory leak. If you only have 5 classes you wrote (and main()), and given the size of the memory increase was so significant, the source of the leak is likely in your SteppingAction.  
Makoto

---

<div class="post-metadata">

**Author:** ![Jiho](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/jiho/32/674_2.png) [@Jiho](https://geant4-forum.web.cern.ch/u/Jiho)\
**Post date:** [February 25, 2020, 8:05am UTC](https://geant4-forum.web.cern.ch/t/multi-threading-ram-issue/1953/3 "2020-02-25T08:05:14Z")

</div>

So you mean I could do the multi-thread simulation when I handle the memory leak problem?

Then I’ll try to fix it. Thank you for your explanation! 🙂
