TMemStatHook.h

Go to the documentation of this file.
00001 // @(#)root/memstat:$Id: TMemStatHook.h 32850 2010-03-31 11:29:44Z anar $
00002 // Author: Anar Manafov (A.Manafov@gsi.de) 2008-03-02
00003 
00004 /*************************************************************************
00005 * Copyright (C) 1995-2010, Rene Brun and Fons Rademakers.               *
00006 * All rights reserved.                                                  *
00007 *                                                                       *
00008 * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010 *************************************************************************/
00011 //
00012 //  TYamsMemHook
00013 //  Non standard C/C++ functions
00014 //  Needed for memory statistic
00015 
00016 #ifndef ROOT_TMemStatHook
00017 #define ROOT_TMemStatHook
00018 
00019 #if defined(__APPLE__)
00020 #ifndef __CINT__
00021 #include <malloc/malloc.h>
00022 #endif
00023 typedef void (*zoneMallocHookFunc_t)(void *ptr, size_t size);
00024 typedef void (*zoneFreeHookFunc_t)(void *ptr);
00025 #endif
00026 
00027 class TMemStatHook {
00028 public:
00029 #if !defined(__APPLE__)
00030    //
00031    // Memory management HOOK functions
00032    //
00033    typedef void*(*MallocHookFunc_t)(size_t size, const void *caller);
00034    typedef void (*FreeHookFunc_t)(void *ptr, const void *caller);
00035 
00036    static MallocHookFunc_t GetMallocHook();         // malloc function getter
00037    static FreeHookFunc_t   GetFreeHook();           // free function getter
00038    static void SetMallocHook(MallocHookFunc_t p);   // malloc function setter
00039    static void SetFreeHook(FreeHookFunc_t p);       // free function setter
00040 #else
00041    //
00042    // Public methods for Mac OS X
00043    //
00044    static void trackZoneMalloc(zoneMallocHookFunc_t pm, zoneFreeHookFunc_t pf);
00045    static void untrackZoneMalloc();
00046 #endif
00047 };
00048 
00049 #endif
00050 

Generated on Tue Jul 5 14:27:17 2011 for ROOT_528-00b_version by  doxygen 1.5.1