Problem with TH1D Write

Hi!

I came across with a strange problem.
In the console application I created TH1D object like
TH1D *d1 = new TH1D(“d1”,"",200,-1.,1.);
fill it in the loop and tried to save in the open ROOT file
d1->Write();

In the ROOT 5.10.00 I got the error without any message.
In the ROOT 5.11.06 I got the error with the next message
CustomReAlloc2 passed oldsize 64, Should be 524299
Fatal in : unreasonable size <524299>

What is it mean?

I work with Windows XP+SP2 and Microsoft Visual Studio 7.1

Thanks in advance,
Andrey Daniel

Could you send the shortest possible RUNNING script reproducing this problem?
Are you running the standard root/root.exe?
or is it your own application? In thsi case are you linking with libNew?

Rene

Hi,

I use own application. libNew was not linked. The part of code that generates the error is here

In the last test variant the external loops were commented.
The full code is attached to this message.
The list of linked libraries are here also . Some of them are not necessary but I copy this line from the old project and did not edit it.

AdditionalDependencies=“libCore.lib libCint.lib libHist.lib libGraf.lib libGraf3d.lib libTree.lib libRint.lib libPostscript.lib libMatrix.lib libPhysics.lib libMinuit.lib”

Andrey Daniel

void Simulate(int n)
{
//========================================
//== Simulate angular distributions between all detector pairs
//========================================

int i,i1,i2;
TVector3 v1,v2;
TFile Fsave(“andist.root”,“RECREATE”);
if(!Fsave.IsOpen())
{
printf(“FILE WAS NOT OPEN\n”);
return;
}

TH1D d1(“d1”,"",200,-1,1);
char name[10];
char title[80];

//for(i1 = 0; i1 < 110; ++i1)
{
//for(i2 = i1+1; i2 < 110; ++i2)
{
//d1.Reset();
//sprintf(name,“d%3.3d_%3.3d”,i1+1,i2+1);
//sprintf(title,“A DISTRIBUTION DET%d AND DET%d”,i1+1,i2+1);
//d1.SetName(name);
//d1.SetTitle(title);

  //printf("DET %3.3d vs DET %3.3d\n",i1+1,i2+1);
  for(i = 0; i < n; ++i)
  {
     GVector(1,v1);
     GVector(2,v2);
     d1.Fill(v1.Unit()*v2.Unit());
  }
  d1.Write();
  }

}
}
ASim.cpp (3.06 KB)

Hi!

This moment I installed ROOT 5.11.06 on the Linux Redhat FC4 and checked the code. It works. What may be wrong on the Windows?

Andrey Daniel

Hi,

If you could provide a fully standalone example (no database access), I will try to reproduce the problem.

Cheers,
Philippe

Hi,

If access to MySql database is changed on the simple reading from the file then code works at Windows XP. But it is not an answer. In this case the change could be done without problem but in other cases I must read data from the database. Also why code reads from database and works on the LINUX? In both cases the code read data from the same database MySql 5.022, which works at Windows XP.

There are only two visible differences at the Windows it was necessary to translate TMySQLServer, TMySQLResult and TMySQLRow classes. At the LINUX I translated all ROOT codes as it is described in the documents.

One can simulate access to the database witout problem. The used table had 3 columns that are detector number and two angles (Theta and Phi). The number of rows and detector numbers must be less then 111.

Sincerely Yours,
Andrey