leak_test.C

Go to the documentation of this file.
00001 // @(#)root/memstat:$Name$:$Id: leak_test.C 34368 2010-07-09 18:34:36Z anar $
00002 // Author: M.Ivanov -- Anar Manafov (A.Manafov@gsi.de) 28/04/2008
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2008, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "TH1.h"
00013 // MemStat
00014 #include "TMemStat.h"
00015 
00016 const int g_count = 2;
00017 
00018 void test1()
00019 {
00020    double* x[g_count];
00021    for(int i = 0; i < g_count; ++i) {
00022       x[i] = new double[i+1];
00023    }
00024    for(int i = 0; i < g_count; ++i) {
00025       delete x[i];
00026    }
00027 }
00028 void test2()
00029 {
00030    TH1F* h[100];
00031    for(int i = 0; i < 100; ++i) {
00032       h[i] = new TH1F(Form("h%d", i), "test", 10 + i, 0, 10);
00033       h[i]->Sumw2();
00034    }
00035 }
00036 void leak_test()
00037 {
00038    TMemStat m("gnubuiltin");
00039    test1();
00040    test2();
00041 }

Generated on Tue Jul 5 14:44:00 2011 for ROOT_528-00b_version by  doxygen 1.5.1