Open konhat88 opened 4 years ago
@konhat88 thanks for the example. I am running 3 different tests:
valgrind
with smaller number of primaries. This is still running (with debug and valgrind
it gets extremely slow). In an initial trial run with only a few thousand primaries valgrind
reported a lot of sometimes boring, sometimes fascinating errors (which we should look into), but for the dose actor I only see that the memory for the dose files (& related images) is apparently not freed at the end (maybe the actors do not get delete
d). That is an issue, but this leak does not scale with the number of primaries, so that is not the leak we are looking for.top
or htop
), and 17 minutes later it is at 665 megabyte. I would love to conclude that apparently the memory leak has been fixed by some commit after the 8.2 release, but I'm actually not so sure. In the GATE stdout/stderr stream there is a HUGE number G4 exceptions that seem to be caused by a small geometry error. Using /geometry/test/run
I see indeed two overlaps of 5 Angstrom, which could be rounding errors. Which should be irrelevant, but from the exceptions it looks like none of tracks is getting anywhere, so the dose actor maybe never gets called and does not get any opportunity to leak.Somehow this problem seems similar to issue https://github.com/OpenGATE/Gate/issues/257 , only with the KillActor instead of the DoseActor. The culprit code in that issue was in the SD code (see PR #266 by @cpommranz ), which would explain why I do not see such a big memory leak in the dose actor in my proton therapy simulations.
To be continued...
I reran test number 1 with the line /gate/moby_phan/attachPhantomSD
commented out. Now there does not seem to be any memory leak at all. This seems to confirm my suspicion that this problem is similar to the KillActor issue: when an actor with step action (like KillActor, DoseActor) is attached to a volume that is also as an "SD" attached to it, then you get a memory leak in Gate v8.2 and earlier. It would be nice if someone who is savvy about the internals of the Gate imaging code (I'm a radiotherapy guy) could confirm this.
Thank you, for your time. I hope for the best with Gate_V9
I think this issue is effectively solved. Please re-open if you disagree. :)
I would like to share my finding here of memory leak involving the use of Dose actor in GATE v8.2, in case it could help anyone in the future. On top of commenting out /gate/***/attachPhantomSD
, the following code still causes memory leak:
#=====================================================
# START
#=====================================================
/gate/application/setTimeSlice 0.001 s
/gate/application/setTimeStart 60 s
/gate/application/setTimeStop 120 s
/gate/application/startDAQ
The slice here is 0.001s, the RAM usage increase quickly, I guess for each time slice GATE creates a frame of the geometry, but it doesn't release it when it moves to the next time slice, which is how RAM usage is built up. One way to circumvent this issue is to use a larger time step.
Not sure why this discussion was closed anyway, but the memory leakage issue caused by voxelized phantom has never been solved.
Hi @ZhengzhiLiu, please have a look at the latest 9.2 version to see if this bug is still there. thanks David
I have observe a memory leak (RAM) when executing dosimetry simulations. I am sharing an example. I have not include the real moby phantom, just a random image with its characteristics. If you run the simulation you will observe that slowly uses more and more RAM memory.
github.zip