TStorage


class description - source file - inheritance tree

class TStorage


    public:
TStorage TStorage(TStorage&) TStorage TStorage() void ~TStorage() void AddToHeap(ULong_t begin, ULong_t end) TClass* Class() void EnableStatistics(int size = -1, int ix = -1) void EnterStat(size_t size, void* p) FreeHookFun_t GetFreeHook() void* GetFreeHookData() ULong_t GetHeapBegin() ULong_t GetHeapEnd() size_t GetMaxBlockSize() Bool_t HasCustomNewDelete() virtual TClass* IsA() const Bool_t IsOnHeap(void* p) void* ObjectAlloc(size_t size, void* vp) void* ObjectAlloc(size_t size) void PrintStatistics() void* ReAlloc(void* vp, size_t size, size_t oldsize) void* ReAlloc(void* vp, size_t size) void RemoveStat(void* p) void SetCustomNewDelete() void SetFreeHook(FreeHookFun_t func, void* data) void SetMaxBlockSize(size_t size) void SetReAllocHooks(ReAllocFun_t func1, ReAllocCFun_t func2) virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b)

Data Members

private:
static ULong_t fgHeapBegin begin address of heap static ULong_t fgHeapEnd end address of heap static size_t fgMaxBlockSize largest block allocated static FreeHookFun_t fgFreeHook function called on free static void* fgFreeHookData data used by this function static ReAllocFun_t fgReAllocHook custom ReAlloc static ReAllocCFun_t fgReAllocCHook custom ReAlloc with length check static Bool_t fgHasCustomNewDelete true if using ROOT's new/delete

Class Description

                                                                      
 TStorage                                                             
                                                                      
 Storage manager. The storage manager works best in conjunction with  
 the custom ROOT new and delete operators defined in the file         
 NEW_NewDelete.cxx (libNew.so). Only when using the custom allocation 
 operators will memory usage statistics be gathered using the         
 TStorage EnterStat(), RemoveStat(), etc. functions.                  
 Memory checking is by default enabled (when using libNew.so) and     
 usage statistics is gathered. Using the resource (in .rootrc):       
 Root.MemStat one can toggle statistics gathering on or off. More     
 specifically on can trap the allocation of a block of memory of a    
 certain size. This can be specified using the resource:              
 Root.MemStat.size, using the resource Root.MemStat.cnt one can       
 specify after how many allocations of this size the trap should      
 occur.                                                               
 Set the compile option R__NOSTATS to de-activate all memory checking 
 and statistics gathering in the system.                              
                                                                      


void EnterStat(size_t size, void *p)
 Register a memory allocation operation. If desired one can trap an
 allocation of a certain size in case one tries to find a memory
 leak of that particular size. This function is only called via
 the ROOT custom new operators.

void RemoveStat(void *vp)
 Register a memory free operation. This function is only called via
 the custom ROOT delete operator.

void* ReAlloc(void *ovp, size_t size)
 Reallocate (i.e. resize) block of memory.

void* ReAlloc(void *ovp, size_t size, size_t oldsize)
 Reallocate (i.e. resize) block of memory. Checks if current size is
 equal to oldsize. If not memory was overwritten.

void* ObjectAlloc(size_t sz)
 Used to allocate a TObject on the heap (via TObject::new()). Directly
 after this routine one can call (in the TObject ctor) TStorage::IsOnHeap()
 to find out if the just created object is on the heap.

void* ObjectAlloc(size_t , void *vp)
 Used to allocate a TObject on the heap (via TObject::new(size_t,void*))
 in position vp. vp is already allocated (maybe on heap, maybe on
 stack) so just return.

void SetFreeHook(FreeHookFun_t fh, void *data)
 Set a free handler.

void SetReAllocHooks(ReAllocFun_t rh1, ReAllocCFun_t rh2)
 Set a custom ReAlloc handlers. This function is typically
 called via a static object in the ROOT libNew.so shared library.

void PrintStatistics()
 Print memory usage statistics.

void EnableStatistics(int size, int ix)
 Enable memory usage statistics gathering. Size is the size of the memory
 block that should be trapped and ix is after how many such allocations
 the trap should happen.

ULong_t GetHeapBegin()

ULong_t GetHeapEnd()

void* GetFreeHookData()

Bool_t HasCustomNewDelete()

void SetCustomNewDelete()

size_t GetMaxBlockSize()

void SetMaxBlockSize(size_t size)

FreeHookFun_t GetFreeHook()



Inline Functions


               void AddToHeap(ULong_t begin, ULong_t end)
             Bool_t IsOnHeap(void* p)
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
           TStorage TStorage()
           TStorage TStorage(TStorage&)
               void ~TStorage()


Author: Fons Rademakers 29/07/95
Last update: 2.23/09 18/11/99 10.46.06 by Rene Brun
Copyright (c) 1995-1999, The ROOT System, All rights reserved. *


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.