On 23 January 2010 15:23, Andriy Zatserklyaniy <zatserkl_at_gmail.com> wrote:
> Well known drawback of
>
> TH1F myhisto(...)
>
> is that, according to C++ rules, the object myhisto will be destroyed after
> exiting of scope, e.g. when your macro will terminate (if you draw this
> histogram in macro, the plot will disappear from TCanvas).
A well known advantaged of not using new is that you don't leak memory ...
but-you-already-know-this'ly yours
Tim
>
> Cheers,
> Andrei.
>
> On Sat, Jan 23, 2010 at 10:48 AM, Marc Escalier <escalier_at_lal.in2p3.fr>
> wrote:
>>
>> Hello,
>>
>> i'm using a basic root program (.C) that allows to make some histograms of
>> variables of a given ntuple (a .root file)
>>
>> Up to now, i created the histogram dynamically with
>> TH1F *myhisto=new TH1F(...)
>>
>> i was wondering what it the more optimal (in terms of memory, cpu usage,
>> or any other criterious you know better than me) way to do ? :
>>
>> *this kind of dynamical allocation
>>
>> or
>>
>> *a non dynamical allocation
>> (i mean :
>> TH1F myhisto(...)
>> )
>>
>> (just in case : i do always the same plots and there variables are always
>> in the ntuple)
>>
>> thanks !
>>
>> (i'll reply in private to answers to prevent spamming you all)
>>
>
>
-- http://tim.jottit.com/Received on Sat Jan 23 2010 - 23:52:47 CET
This archive was generated by hypermail 2.2.0 : Sun Jan 24 2010 - 05:50:02 CET