TString hangs

From: Martin Woudstra (Martin.Woudstra@cern.ch)
Date: Mon Apr 20 1998 - 13:17:47 MEST


Dear rooters,

I have a weird problem with TString (HPUX 10.20 aCC root 1.03/09)
At runtime I get the following error message:

Pid 3711 received a SIGSEGV for stack growth failure.
Possible causes: insufficient memory or swap space,
or stack size exceeded maxssiz.

When I run it in a debugger (dde), it seems that, on calling
TString::Data(), I keep jumping in between two ROOT TString 
functions, namely:

const char* TString::Data() const { return fData; }
and
char* TStringRef::Data() const { return (char()(this+1);}

The 'this pointer' in TStringRef::Data() keeps the same value
all the time, but the 'this pointer' in TString::Data() jumps
upwards in steps of 0x40 each iteration. The program just
keeps jumping in between those two functions and produces the
above error message, and just hangs afterwards...


Any idea??

Regards,

Martin.


=================================
Relevant Code:

class TParameters {
private:
   int m_nPar;			// number of parameters
   TVector m_Value;			// vector with parameter values
   TVector m_Error;			// vector with errors on parameters
   TObjArray m_Name;			// array of names of parameters
   TMatrix m_Covar;			// Covariance matrix (== inverse of A)
   TMatrix m_Corr;			// Correlation matrix

public:
   TParameters(int n);					// Initialise memory for n parameters
   ~TParameters(void);					// Free memory
   TParameters(const TParameters &);			// copy ctor
   inline void SetName(int i, char* const name);	// Set name of
parameter #i
   inline void SetName(int i, const TString &name);	// Set name of
parameter #i
   TString GetName(int i) const { return
((TObjString*)(m_Name.At(i)))->GetString(); }

......
}
  
  TParameters::TParameters(const TParameters &par)
     : m_nPar(par.m_nPar), m_Value(par.m_Value), m_Error(par.m_Error),
       m_Covar(par.m_Covar), m_Corr(par.m_Corr)
  {
    m_Name.Expand(m_nPar);
    for (int i = 0; i < m_nPar; i++) {
====>    SetName(i, par.GetName(i));
    }
  }


inline void TParameters::SetName(int i, const TString &name) {
   SetName(i, name.Data());
}

inline void TParameters::SetName(int i, char* const name) {
   if (m_Name.At(i) != 0) delete m_Name.At(i);
   m_Name.AddAt(new TObjString(name), i);
}



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:32 MET