Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PsnThreadMemoryManager.h

Go to the documentation of this file.
00001 /*
00002  * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software
00003  * 
00004  * The Software has been developped within the Siames Project. 
00005  * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights
00006  * 
00007  * The Software has been registered with the Agence pour la Protection des
00008  * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200
00009  *
00010  * This file may be distributed under the terms of the Q Public License
00011  * version 1.0 as defined by Trolltech AS of Norway and appearing in the file
00012  * LICENSE.QPL included in the packaging of this file.
00013  *
00014  * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 
00015  * for the software may use this file in accordance with that specific license
00016  *
00017  */
00018 #ifndef PsnThreadMemoryManagerHEADER
00019 #define PsnThreadMemoryManagerHEADER
00020 
00021 #include "PsnMemoryManager.h"
00022 #include <pthread.h>
00023 
00024 class PsnMemoryElementDescriptor ;
00030 class PsnThreadMemoryManager : public PsnMemoryManager
00031 {
00032 public:
00034    virtual ~PsnThreadMemoryManager() ;
00035 
00036 
00043    PsnThreadMemoryManager ( void *startDsm, 
00044                             size_t sizeDsm, 
00045                             PsnMemoryManager & rawMemoryProvider,
00046                             PsnMemoryManager & descriptorMemoryProvider) ;
00047 
00049    virtual void * allocateSizeRemembered (size_t size) ;
00050 
00052    virtual void freeSizeRemembered ( void * ptr) ;
00053 
00055    virtual void mfreeSizeRememberedOtherThread ( void * ptr) ;
00056 
00058    virtual bool inAdressSpace(void * ptr) const ; 
00059 
00061    static void freeLeakedMemoryBlocks () ;
00062 
00063 protected:
00065    static list <void *> & getListOfDetachedMemoryBlocks () ;
00066 
00068    static list <pair <void *, PsnThreadMemoryManager *> > & getListOfLeakedMemoryBlocks () ;
00069 
00070    static PsnMutexLock & getFreedMemoryBlocksMutex() ;
00071 
00072    static PsnMutexLock & getLeakedMemoryBlocksMutex() ;
00073 
00074    virtual void * getFromFree ( size_t size );
00075 
00076    virtual void addInFree(void * ptr, size_t size) ;
00077    
00078    
00080    size_t _memoryManaged ; 
00081 
00083    PsnMemoryManager & _rawMemoryProvider ;
00084 
00086    PsnMemoryManager & _descriptorMemoryProvider ;
00087 
00089    PsnMemoryElementDescriptor * _freeMemoryZones ;
00090 
00092    PsnMemoryElementDescriptor * _managedMemoryZones ;
00093 
00095    pthread_t _user ;
00096    
00097 };
00098 
00099 #endif

logo OpenMask

Documentation generated on Mon Nov 25 15:25:01 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001