Version
menu_open
link

include/AK/SoundEngine/Common/AkMemoryMgr.h

Go to the documentation of this file.
00001 
00002 //
00003 // Copyright (c) 2006 Audiokinetic Inc. / All Rights Reserved
00004 //
00006 
00009 
00010 #ifndef _AKMEMORYMGR_H_
00011 #define _AKMEMORYMGR_H_
00012 
00013 #include <AK/SoundEngine/Common/AkTypes.h>
00014 #include <AK/SoundEngine/Common/AkSoundEngineExport.h>
00015 
00016 #ifndef AK_OPTIMIZED
00017 
00018 #define AK_MAX_MEM_POOL_NAME_SIZE 64
00019 
00021 #define AK_SETPOOLNAME( _poolid, _name )                \
00022     if( AK_INVALID_POOL_ID != _poolid )                 \
00023     {                                                   \
00024         AK::MemoryMgr::SetPoolName( _poolid, _name );   \
00025     }
00026 
00027 //#define AK_MEMDEBUG
00028 
00029 #else
00030 #define AK_SETPOOLNAME(_poolid,_name)
00031 #endif
00032 
00033 
00034 namespace AK
00035 {   
00040     namespace MemoryMgr
00041     {
00048         struct PoolStats
00049         {
00050             // Current state
00051             AkUInt32 uReserved;     
00052             AkUInt32 uUsed;         
00053             AkUInt32 uMaxFreeBlock; 
00054 
00055             // Statistics
00056             AkUInt32 uAllocs;       
00057             AkUInt32 uFrees;        
00058             AkUInt32 uPeakUsed;     
00059         };
00060 
00065         struct PoolMemInfo
00066         {
00067             // Current state
00068             AkUInt32 uReserved;     
00069             AkUInt32 uUsed;         
00070         };
00071 
00078         AK_EXTERNAPIFUNC( bool, IsInitialized )();
00079 
00084         AK_EXTERNAPIFUNC( void, Term )();
00085 
00088 
00089 
00097         AK_EXTERNAPIFUNC( AkMemPoolId, CreatePool )(
00098             void *          in_pMemAddress,     
00099             AkUInt32        in_uMemSize,        
00100             AkUInt32        in_uBlockSize,      
00101             AkUInt32        in_eAttributes,     
00102             AkUInt32        in_uBlockAlign = 0  
00103             );
00104 
00105 #ifdef AK_SUPPORT_WCHAR
00106 
00107 
00108 
00109 
00110         AK_EXTERNAPIFUNC( AKRESULT, SetPoolName )( 
00111             AkMemPoolId     in_poolId,          
00112             const wchar_t*  in_pszPoolName      
00113             );
00114 #endif //AK_SUPPORT_WCHAR
00115 
00120         AK_EXTERNAPIFUNC( AKRESULT, SetPoolName )( 
00121             AkMemPoolId     in_poolId,          
00122             const char*     in_pszPoolName      
00123             );
00124 
00129         AK_EXTERNAPIFUNC( AkOSChar*, GetPoolName )( 
00130             AkMemPoolId     in_poolId           
00131             );
00132         
00139         AK_EXTERNAPIFUNC( AKRESULT, SetMonitoring )(
00140             AkMemPoolId     in_poolId,          
00141             bool            in_bDoMonitor       
00142             );
00143 
00148         AK_EXTERNAPIFUNC( AKRESULT, DestroyPool )(
00149             AkMemPoolId     in_poolId           
00150             );
00151 
00156         AK_EXTERNAPIFUNC( AKRESULT, GetPoolStats )(
00157             AkMemPoolId     in_poolId,          
00158             PoolStats&      out_stats           
00159             );
00160 
00168         AK_EXTERNAPIFUNC( void, GetPoolMemoryUsed )(
00169             AkMemPoolId     in_poolId,          
00170             PoolMemInfo&    out_memInfo         
00171             );
00172 
00177         AK_EXTERNAPIFUNC( AkInt32, GetNumPools )();
00178 
00183         AK_EXTERNAPIFUNC( AkInt32, GetMaxPools )();
00184 
00190         AK_EXTERNAPIFUNC( AKRESULT, CheckPoolId )(
00191             AkMemPoolId     in_poolId           
00192             );
00193 
00198         AK_EXTERNAPIFUNC( AkMemPoolAttributes, GetPoolAttributes )(
00199             AkMemPoolId     in_poolId           
00200             );
00201 
00203 
00206 
00207 
00208 #if defined (AK_MEMDEBUG)
00209 
00210 
00211 
00212 
00213         AK_EXTERNAPIFUNC( void *, dMalloc )(
00214             AkMemPoolId in_poolId,              
00215             size_t      in_uSize,               
00216             const char *in_pszFile,             
00217             AkUInt32    in_uLine                
00218             );
00219 #endif
00220 
00221 
00222 
00223 
00224         AK_EXTERNAPIFUNC( void *, Malloc )(
00225             AkMemPoolId in_poolId,              
00226             size_t      in_uSize                
00227             );
00228 
00233         AK_EXTERNAPIFUNC( AKRESULT, Free )(
00234             AkMemPoolId in_poolId,              
00235             void *      in_pMemAddress          
00236             );
00237 
00238 #if defined (AK_MEMDEBUG)
00239 
00240 
00241 
00242 
00243 
00244         AK_EXTERNAPIFUNC( void *, dMalign )(
00245             AkMemPoolId in_poolId,              
00246             size_t      in_uSize,               
00247             AkUInt32    in_uAlignment,          
00248             const char*  in_pszFile,            
00249             AkUInt32    in_uLine                
00250             );
00251 #endif
00252 
00258         AK_EXTERNAPIFUNC( void *, Malign )(
00259             AkMemPoolId in_poolId,              
00260             size_t      in_uSize,               
00261             AkUInt32    in_uAlignment           
00262             );
00263 
00270         AK_EXTERNAPIFUNC( AKRESULT, Falign )(
00271             AkMemPoolId in_poolId,              
00272             void *      in_pMemAddress          
00273             );
00274 
00276 
00279 
00280 
00290         AK_EXTERNAPIFUNC( void *, GetBlock )(
00291             AkMemPoolId in_poolId               
00292             );
00293 
00299         AK_EXTERNAPIFUNC( AKRESULT, ReleaseBlock )(
00300             AkMemPoolId in_poolId,              
00301             void *      in_pMemAddress          
00302             );
00303 
00311         AK_EXTERNAPIFUNC( AkUInt32, GetBlockSize )(
00312             AkMemPoolId in_poolId               
00313             );
00314 
00317         AK_EXTERNAPIFUNC( void, StartProfileThreadUsage) (
00318             AkMemPoolId in_PoolId   
00319             );
00320 
00324         AK_EXTERNAPIFUNC( AkUInt32, StopProfileThreadUsage ) (
00325             AkMemPoolId in_PoolId   
00326             );
00327 
00329     }
00330 }
00331 
00332 #endif // _AKMEMORYMGR_H_

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise