Problem with TH1D Write


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

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?



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”);
printf(“FILE WAS NOT OPEN\n”);

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)
//sprintf(title,“A DISTRIBUTION DET%d AND DET%d”,i1+1,i2+1);

  //printf("DET %3.3d vs DET %3.3d\n",i1+1,i2+1);
  for(i = 0; i < n; ++i)

ASim.cpp (3.06 KB)


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


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



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,