Message: Re: How to find out segmentation error in this case? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: How to find out segmentation error in this case? 

Forum: Particles
Re: None How to find out segmentation error in this case? (long)
Date: 18 Dec, 2006
From: Vladimir IVANTCHENKO <vnivanch@mail.cern.ch>

On Sat, 16 Dec 2006, long wrote:

> *** Discussion title: Particles
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/particles/309"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hi,everyone. Could we discuss about how to debug our codes, especially for
> segmentation error. Because I am a beginner. When I began to write my codes, I met
> many problems,especially segmentation errors. I found it is hard for a freshman
> to find out what happened? So I think this discussion will help all beginers like me.
>     Here is my concrete case, when I use geant4info particle, no error occured. 
> But when I use electron, segmentation error will happen. Then if I remove some codes on Visualization,
> the error will disappear. By using GDB, I found the errors only come up at the end of main(), I mean, after delete
> runManager,visManger... So I guess maybe the application try to free
> some memory which had been freed or which don't belong to it. But where is the 
> problem? So could anybody give some general ideas on how to deal with these kind things?
>   Thank you very much!
> 

Hello,

Your analysis is correct - in your application at the end you delete some 
objects, which also are deleted by Geant4 kernel. One suggestion:
Try to use gdb debugger:

gdb myg4
> run mymacro
> where

"myg4" is your executable, "mymacro" is your macro-file, "run" and "where" 
are gdb commands.

VI

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: How to find out segmentation error in this case?   (long - 18 Dec, 2006)
(_ None: Re: How to find out segmentation error in this case?   (Vladimir IVANTCHENKO - 19 Dec, 2006)
 Add Message Add Message
to: "Re: How to find out segmentation error in this case?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]