[ROOT] TVector::ResizeTo shows odd behavior

From: Remi Mommsen (remigius.mommsen@cern.ch)
Date: Fri Apr 16 2004 - 05:36:48 MEST


Hi,

I have a problem with Root 4.00/03 on Mac OS X 10.3 and RH9 concerning 
TVector::ResizeTo.
  The following macro illustrates the problem:

{
   TVector vector(10);

   vector(0) = 1;
   vector(1) = 2;
   vector(2) = 3;
   vector(3) = 4;
   vector(4) = 5;

   vector.Print();

   vector.ResizeTo(5);

   vector.Print();
}

produces:

Vector 10 is as follows

      |        1  |
------------------
    0 |1
    1 |2
    2 |3
    3 |4
    4 |5
    5 |0
    6 |0
    7 |0
    8 |0
    9 |0


Vector 5 is as follows

      |        1  |
------------------
    0 |0
    1 |0
    2 |0
    3 |0
    4 |5

The interesting thing is, that sometimes it produces the correct 
result. But after the correct run, the next try gives:
*** malloc[5764]: error for object 0x1edf990: Incorrect checksum for 
freed object - object was probably modified after being freed; break at 
szone_error

It works as expected using root 3.10/02.

Cheers,
		Remi


---------------------------------------------------------------------
"Sometimes I think the surest sign that intelligent life exists else-
where in the universe is that none of it has tried to contact us."
                                               Calvin (Bill Watterson)

*********************************************************************
Remigius K. Mommsen                 e-mail: mommsen@slac.stanford.edu
University of California, Irvine       URL:    http://cern.ch/mommsen
c/o SLAC                             voice:        ++1 (650) 926-3595
2575 Sand Hill Road #35                fax:        ++1 (650) 926-3882
Menlo Park, CA 94025, US              home:        ++1 (650) 233-9041
*********************************************************************



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:07 MET