Logo ROOT  
Reference Guide
TMemStatHook.h
Go to the documentation of this file.
1// @(#)root/memstat:$Id$
2// Author: Anar Manafov (A.Manafov@gsi.de) 2008-03-02
3
4/*************************************************************************
5* Copyright (C) 1995-2010, Rene Brun and Fons Rademakers. *
6* All rights reserved. *
7* *
8* For the licensing terms see $ROOTSYS/LICENSE. *
9* For the list of contributors see $ROOTSYS/README/CREDITS. *
10*************************************************************************/
11//
12// TYamsMemHook
13// Non standard C/C++ functions
14// Needed for memory statistic
15
16#ifndef ROOT_TMemStatHook
17#define ROOT_TMemStatHook
18
19#include <stddef.h>
20
21#if defined(__APPLE__)
22#ifndef __CINT__
23#include <malloc/malloc.h>
24#endif
25typedef void (*zoneMallocHookFunc_t)(void *ptr, size_t size);
26typedef void (*zoneFreeHookFunc_t)(void *ptr);
27#endif
28
30public:
31#if !defined(__APPLE__)
32 //
33 // Memory management HOOK functions
34 //
35 typedef void*(*MallocHookFunc_t)(size_t size, const void *caller);
36 typedef void (*FreeHookFunc_t)(void *ptr, const void *caller);
37
38 static MallocHookFunc_t GetMallocHook(); // malloc function getter
39 static FreeHookFunc_t GetFreeHook(); // free function getter
40 static void SetMallocHook(MallocHookFunc_t p); // malloc function setter
41 static void SetFreeHook(FreeHookFunc_t p); // free function setter
42#else
43 //
44 // Public methods for Mac OS X
45 //
46 static void trackZoneMalloc(zoneMallocHookFunc_t pm, zoneFreeHookFunc_t pf);
47 static void untrackZoneMalloc();
48#endif
49};
50
51#endif
52
typedef void((*Func_t)())
static MallocHookFunc_t GetMallocHook()
GetMallocHook - a static function malloc function getter.
static void SetMallocHook(MallocHookFunc_t p)
SetMallocHook - a static function Set pointer to function replacing alloc function.
void(* FreeHookFunc_t)(void *ptr, const void *caller)
Definition: TMemStatHook.h:36
void *(* MallocHookFunc_t)(size_t size, const void *caller)
Definition: TMemStatHook.h:35
static FreeHookFunc_t GetFreeHook()
GetFreeHook - a static function free function getter.
static void SetFreeHook(FreeHookFunc_t p)
SetFreeHook - a static function Set pointer to function replacing free function.