Re: Segfault when cloning a used class

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 14 May 2009 09:08:06 -0500


Hi,

 > What do you mean with I/O settings?

See the Users' guide for details. For example you can tell the I/O that a pointer is always allocated in
the default constructor:

    myclass *ptr; //->
or you can give the size of an array:

    int *arr; //[n]

 > in fact the source of this segfault is the Streamer of the mother class.
 > But I don't understand, because these classes contain only primitive non-
 > pointer data members...

Humm... There can be many many causes depending on the shapes of your classes and how
you use them. Your best bet is to use valgrind to pin point the location of the problem. One possibly issues is that the default constructor is not properly initializing
all the data memebers.
Cheers,
Philippe

Alberto Pulvirenti wrote:
> Hi,
>
> in fact the source of this segfault is the Streamer of the mother class.
> But I don't understand, because these classes contain only primitive non-
> pointer data members...
>
> What do you mean with I/O settings?
>
> Thanks, cheers
>
> Alberto
>
> On Wednesday 13 May 2009 06:25:25 pm Philippe Canal wrote:
>
>> Hi,
>>
>> The clone method is using the I/O to write and then read back the
>> object. The problem is likely
>> to be in the default constructor and/or the I/O setting of the members
>> that pointers.
>>
>> Cheers,
>> Philippe.
>>
>> Alberto Pulvirenti wrote:
>>
>>> Dear all,
>>>
>>> I am experiencing a strange thing in a class I implemented.
>>> This class inherits from another base class, which in turn inherits from
>>> TNamed.
>>> The strange thing is that when I invoke the "Clone()" method on an object
>>> declared as this class type, this raises a segmentation fault.
>>>
>>> I was wandering if this can be explained with some known mistakes in
>>> class implementation, since I don't really know well how the "Clone()"
>>> method works.
>>>
>>> Thanks, cheers
>>>
>>> Alberto
>>>
>
>
Received on Thu May 14 2009 - 16:08:25 CEST

This archive was generated by hypermail 2.2.0 : Thu May 14 2009 - 17:50:02 CEST