/usr/include/root/TStorage.h is in libroot-core-dev 5.34.14-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | // @(#)root/base:$Id$
// Author: Fons Rademakers 29/07/95
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TStorage
#define ROOT_TStorage
//////////////////////////////////////////////////////////////////////////
// //
// TStorage //
// //
// Storage manager. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
typedef void (*FreeHookFun_t)(void*, void *addr, size_t);
typedef void *(*ReAllocFun_t)(void*, size_t);
typedef void *(*ReAllocCFun_t)(void*, size_t, size_t);
typedef char *(*ReAllocCharFun_t)(char*, size_t, size_t);
class TStorage {
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
public:
virtual ~TStorage() { }
static ULong_t GetHeapBegin();
static ULong_t GetHeapEnd();
static FreeHookFun_t GetFreeHook();
static void *GetFreeHookData();
static size_t GetMaxBlockSize();
static void *Alloc(size_t size);
static void Dealloc(void *ptr);
static void *ReAlloc(void *vp, size_t size);
static void *ReAlloc(void *vp, size_t size, size_t oldsize);
static char *ReAllocChar(char *vp, size_t size, size_t oldsize);
static Int_t *ReAllocInt(Int_t *vp, size_t size, size_t oldsize);
static void *ObjectAlloc(size_t size);
static void *ObjectAlloc(size_t size, void *vp);
static void ObjectDealloc(void *vp);
static void ObjectDealloc(void *vp, void *ptr);
static void EnterStat(size_t size, void *p);
static void RemoveStat(void *p);
static void PrintStatistics();
static void SetMaxBlockSize(size_t size);
static void SetFreeHook(FreeHookFun_t func, void *data);
static void SetReAllocHooks(ReAllocFun_t func1, ReAllocCFun_t func2);
static void SetCustomNewDelete();
static void EnableStatistics(int size= -1, int ix= -1);
static Bool_t HasCustomNewDelete();
// only valid after call to a TStorage allocating method
static void AddToHeap(ULong_t begin, ULong_t end);
static Bool_t IsOnHeap(void *p);
ClassDef(TStorage,0) //Storage manager class
};
#ifndef WIN32
inline void TStorage::AddToHeap(ULong_t begin, ULong_t end)
{ if (begin < fgHeapBegin) fgHeapBegin = begin;
if (end > fgHeapEnd) fgHeapEnd = end; }
inline Bool_t TStorage::IsOnHeap(void *p)
{ return (ULong_t)p >= fgHeapBegin && (ULong_t)p < fgHeapEnd; }
inline size_t TStorage::GetMaxBlockSize() { return fgMaxBlockSize; }
inline void TStorage::SetMaxBlockSize(size_t size) { fgMaxBlockSize = size; }
inline FreeHookFun_t TStorage::GetFreeHook() { return fgFreeHook; }
#endif
#endif
|