TStorage


class description - source file - inheritance tree

class TStorage


    public:
TStorage TStorage() TStorage TStorage(TStorage&) void ~TStorage() TClass* Class() void EnableStatistics(int size = -1, int ix = -1) void EnterStat(size_t size, void* p) FreeHookFun_t GetFreeHook() void* GetFreeHookData() ULong_t GetLastObject() ULong_t GetLastObjectEnd() size_t GetMaxBlockSize() Bool_t HasCustomNewDelete() virtual TClass* IsA() Bool_t IsOnHeap(void* p) void* ObjectAlloc(size_t size) void* ObjectAlloc(size_t size, void* vp) void PrintStatistics() void* ReAlloc(void* vp, size_t size) void* ReAlloc(void* vp, size_t size, size_t oldsize) void RemoveStat(void* p) void SetCustomNewDelete() void SetFreeHook(FreeHookFun_t func, void* data) void SetLastObject(ULong_t obj) void SetLastObjectEnd(ULong_t obj) 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 fgLastObject begin address of last allocated obj static ULong_t fgLastObjectEnd end address of last allocated obj 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 sz, void *vp)
 Used to allocate a TObject on the heap (via TObject::new()) in
 position vp.

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 GetLastObject()

ULong_t GetLastObjectEnd()

void* GetFreeHookData()

Bool_t HasCustomNewDelete()

void SetCustomNewDelete()

size_t GetMaxBlockSize()

void SetMaxBlockSize(size_t size)

FreeHookFun_t GetFreeHook()

void SetLastObject(ULong_t obj)

void SetLastObjectEnd(ULong_t obj)



Inline Functions


             Bool_t IsOnHeap(void* p)
            TClass* Class()
            TClass* IsA()
               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.21/05 08/02/99 12.32.45 by Fons Rademakers
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.