You should not delete the function inside the loop.
See modified code below
Rene Brun
> ----------
> The code |
> -------------------------
> 
>   Double_t myfunction(Double_t *x, Double_t *par) // Fitting function.
>   { .........................................}
> 
>   void fit()
>   {
>      ...................
> 
       FitFunc = new TF1("myfunction",myfunction,-10,20,2);
>      for(int i=0;i<=200;i++)       //*****>   repeat fitting 200 times
>      {  ...................
> 
>         fpx = new TH1F("fpx","",BinNum, Xmin,Xmax);
> 
>         for(int j=0;j<1000;j++)
>                   fpx->Fill(....);    //****> 1000 Monte Carlo Events
> 
>         FitFunc->SetParameters(0.5,0.1);
>         FitFunc->SetParNames("Normalize","Most Probable");
>         fpx->Fit("myfunction","r");
> 
>         delete fpx;
>      }
       delete FitFunc;
>   }