[Gate-users] Fw: Problem with 'std::bad_alloc'
Michal Knap
knap.michal at yahoo.com
Thu Jan 14 13:35:14 CET 2016
Hi All,I'm attaching my whole conversation with David and files below.Could you please help with solving this issue?It's a strange bug which causes huge consumption of RAM and gives me this error message
/terminate called after throwing an instance of 'std::bad_alloc'/ / what(): std::bad_alloc/
/Przerwane (core dumped)/
My visualization doesn't even start but it is the smallest problem.
I run benchmark simulation just to check if is everything all right with my Gate and it all works (benchmarkSPECT.mac with visualization works fine).
I'm working on ubuntu 14.04 LTS / Geant4.9.6.p04 / Gate_v7.0/ ROOT 5.34.34.On machine with i5VPRO/2.4GHz/8GB/128 SSD.
Can anybody help me with this issue?I'll be very thankful.
Best Regards&ThanksMichał Knap
13:07 czwartek, 2016-1-14, David Boersma <david.boersma at physics.uu.se> napisał(a):
Hi,
All:
Could other people please have a look at Michał's problem? I could run
his macro (see his previous mail) and Gate indeed consumes excessive
amounts of RAM, but it is not clear to me why that happens. See below
for my observations. I have to work on other things now.
Michał:
Yes, I could run your macro. I disabled all the lines with "/vis" in
them, ran the command "Gate ./minigamma1pointsourceoncollimator.mac" and
then observed in a separate window with "htop" how things were going,
resource-wise.
I ran this on a machine with 16 GiB of RAM, Ubuntu 14.04, Geant
4.9.6.p04. It took about a minute to fill up all the RAM, and then it
started to eat up the swap space. When it had eaten up 90% of the swap
space I killed the program (from within htop; I was not able to kill
Gate with ctrl-C).
I think we can conclude that "something" in Gate is allocating too much
memory. It could be a spectacular memory leak, or it could be some
missconfigured component in your macro that causes excessive resource
consumption. For the latter hypothesis I looked at your macro for
suspicious things, but the most segmented thing I could find was the
"projection" output, and replacing 128*128 by 4*4 did not help at all. I
reduced the time slice from 1s to 0.001s and the time stop from 60s to
0.002s, but that did not seem to change anything either.
Maybe there is some implicit/default setting that is wrong for your
application. I am not an imaging expert (I use gate for radiotherapy),
so maybe someone else has an idea.
I ran it in "gdb" (the GNU debugger) and stopped the program by sending
it a signal, while it was eating memory, and checked with "bt"
(backtrace) in which function it was running at the moment I stopped it.
I repeated this several times and got different backtraces every time,
so this did not provide any useful hints for finding out which part of
the code is responsible.
This is as far as I could get, and the problem is not yet solved. I hope
someone else on the list can take over to help you solve this. Maybe
someone should run it with "valgrind", but that can be pretty time
consuming, and maybe someone actually already knows, that would be much
more efficient.
Good luck,
David B.
Den 13/01/2016 kl. 20:26, skrev Michal Knap:
> Hi David,
> It would be really great if you could take a look on my mac file.
> Please see the attachment.
> I'm a little bit confused about this bug.
>
> I will try to try out your idea with much simplified version and will
> return with the results.
>
> Thanks&Regards
> Michał Knap
>
>
>
> 12:00 środa, 2016-1-13, David Boersma <david.boersma at physics.uu.se>
> napisał(a):
>
>
> Hi Michał,
>
> On 2016-01-13 07:04, Michal Knap wrote:
> > Hi David,
> > I have only one version of Gate and Geant4 installed - Gate v7.0 and
> > Geant4.9.6.p04.
> >
> > I successfully run benchmark simulation - benchmarkSPECT, with or
> > without visualization.
> >
> > So it's somthing with my code i think. What can i disable/enable to fix
> > this bug?
>
> If there is indeed something wrong with your code then we can only help
> you by looking at your code.
>
> So, as I wrote in my previous mail, it would be nice if you could make a
> short and strongly simplified version of your macro which still crashes
> in the same way. Preferably it only uses input data from the examples
> and benchmarks. E.g. you define only a very crude geometry and a gamma
> source, and a number of primaries, no visualization. If that throws the
> same bad_alloc exception, then please send that to us, we can try to
> reproduce and tell you what's wrong. Of course it is possible that the
> problem disappears after you take out certain parts of the macro. If you
> can nail it down to one particular line or set of lines that makes the
> difference between crashing and not crashing, then quote those lines to
> us. That is less helpful the first option, but could still provide a hint.
>
> David B.
>
>
> >
> > Best regards
> > Michał Knap
> >
> >
> > 18:11 wtorek, 2016-1-12, David Boersma <david.boersma at physics.uu.se
> <mailto:david.boersma at physics.uu.se>>
> > napisał(a):
> >
> >
> > Hi Michał,
> >
> > Some more simple questions:
> >
> > * Can you run macros from the example directory successfully, or do some
> > of them result in this same error?
> >
> >
> > * Do you have multiple versions of Geant4 and/or Root installed? If yes,
> > could you check with the following command:
> >
> > ldd $(which Gate)
> >
> > that your Gate executable gets indeed linked to the same versions as the
> > ones you configured during installation of Gate? If the versions do not
> > match: then fix your environment, or reinstall Gate (from scratch).
> >
> >
> >
> > If these simple questions do not help, then I think the next step is to
> > make a minimalistic version of your macro that demonstrates the error
> > you are seeing and post it here on the list, so that other people have a
> > chance to reproduce this problem. Please also specify how you run the
> > Gate command (with which options).
> >
> > HTH,
> > David Boersma
> >
> > Den 12/01/2016 kl. 17:35, skrev Michal Knap:
> > > Hi David,
> > > I checked you idea but i use only 50-60% RAM memory.
> > > While i'm running simulation i do not use any other apps.
> > > Even browser is closed.
> > >
> > > I have intel i5 vPRO, 8GB RAM, 120 GB SSD
> > > Ubuntu 14.04 LTS, Geant4.9.6.p04,Gate7.0,Root 5.34.34
> > >
> > > Kind regards
> > >
> > >
> > > 17:01 wtorek, 2016-1-12, David Boersma
> <david.boersma at physics.uu.se <mailto:david.boersma at physics.uu.se>
> > <mailto:david.boersma at physics.uu.se
> <mailto:david.boersma at physics.uu.se>>>
> > > napisał(a):
> > >
> > >
> > >
> > >
> > > Hi Michał,
> > >
> > > My first guess would be a memory problem. Could you check with some
> > > resource monitor ("top" or "htop" on linux, "Activity Monitory" on
> > > MacOSX) how much RAM is used on your machine, by which programs?
> > >
> > > It could be that other programs than GATE (e.g. a web browser) are
> using
> > > so much RAM that there is not enough available for your GATE
> > > application. Then this is easily solved by quitting those other
> programs.
> > >
> > > It could be that you configured GATE too optimistically, e.g. using a
> > > scoring volume with too many voxels. Then you should either use a more
> > > modest configuration, or run on a bigger machine.
> > >
> > > There are many other possible causes, but these are the easiest
> ones, I
> > > can think of. It would be good if you could tell us whether these are
> > > already ruled out.
> > >
> > > Also: when reporting problems and asking for help, it could be helpful
> > > if you would add some basic specs about the OS (+version) and the
> > > hardware (in particular how much RAM your have). Which version of GATE
> > > are you using, with which version of Geant4? How did you install
> it? Did
> > > you install it recently or long ago?
> > >
> > > HTH,
> > > David
> > >
> > > Den 12/01/2016 kl. 15:55, skrev Michal Knap:
> > > > Hi All,
> > > > As i'm trying to simulate a minigammacamera i'm getting this error
> > > message.
> > > > I still do not know how to fix this.
> > > > Can anybody know what is wrong?
> > > > //
> > > > /[Acquisition-0] Slice 0 from 0 to 37.5 s [slice=37.5 s], final
> > stop at
> > > > 150 s./
> > > > /terminate called after throwing an instance of 'std::bad_alloc'/
> > > > / what(): std::bad_alloc/
> > > > /Przerwane (core dumped)/
> > > > /
> > > > /
> > > > I'll be very thankful for any help.
> > > >
> > > > Thanks in advance
> > > >
> > > > Kind regards
> > > > Michał Knap
> > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Gate-users mailing list
> > > > Gate-users at lists.opengatecollaboration.org
> <mailto:Gate-users at lists.opengatecollaboration.org>
> > <mailto:Gate-users at lists.opengatecollaboration.org
> <mailto:Gate-users at lists.opengatecollaboration.org>>
> > > <mailto:Gate-users at lists.opengatecollaboration.org
> <mailto:Gate-users at lists.opengatecollaboration.org>
> > <mailto:Gate-users at lists.opengatecollaboration.org
> <mailto:Gate-users at lists.opengatecollaboration.org>>>
> > > > http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
> > > >
> > > _______________________________________________
> > > Gate-users mailing list
> > > Gate-users at lists.opengatecollaboration.org
> <mailto:Gate-users at lists.opengatecollaboration.org>
> > <mailto:Gate-users at lists.opengatecollaboration.org
> <mailto:Gate-users at lists.opengatecollaboration.org>>
>
> > > <mailto:Gate-users at lists.opengatecollaboration.org
> <mailto:Gate-users at lists.opengatecollaboration.org>
> > <mailto:Gate-users at lists.opengatecollaboration.org
> <mailto:Gate-users at lists.opengatecollaboration.org>>>
> >
> > > http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
> > >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20160114/0fb05180/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GateMaterials.db
Type: application/octet-stream
Size: 17120 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20160114/0fb05180/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Materials.xml
Type: text/xml
Size: 1608 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20160114/0fb05180/attachment-0001.xml>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minigamma1pointsourceoncollimator.mac
Type: application/octet-stream
Size: 7299 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20160114/0fb05180/attachment-0003.obj>
More information about the Gate-users
mailing list