diff -r 597aaf25e343 -r e7d2d738d3c2 userlibandfileserver/fileserver/sfile/sf_std.h --- a/userlibandfileserver/fileserver/sfile/sf_std.h Fri Mar 12 15:50:11 2010 +0200 +++ b/userlibandfileserver/fileserver/sfile/sf_std.h Mon Mar 15 12:45:50 2010 +0200 @@ -1398,9 +1398,10 @@ TRequestStatus iStatus; TBool iIsAllocated; }; -const TInt KMaxRequestAllocated = 45; -const TInt KMaxOperationAllocated = KMaxRequestAllocated * 2; -const TInt KAllocReqBlock=15; + +// If the number of requests on the free queue reaches this value then completed requests +// are returned to the heap rather than being added to thefree queue +const TInt KFreeCountMax = 64; class TParseCon { @@ -1413,34 +1414,53 @@ class RequestAllocator { public: + static TInt Initialise(); + static TInt GetMessageRequest(const TOperation& aOperation,const RMessage2& aMessage,CFsClientMessageRequest* &aRequest); - static void FreeRequest(CFsClientMessageRequest* aRequest); // Use the one from cache + static void FreeRequest(CFsClientMessageRequest* aRequest); static void OpenSubFailed(CSessionFs* aSession); - static TInt AllocRequest(TInt aNum); + +#if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE) + inline static TInt RequestCount(); + inline static TInt RequestCountPeak(); + static TInt CloseCount(); + static TInt FreeCount(); +#endif + +private: + static CFsClientMessageRequest* GetRequest(); - static TInt AllocOperation(); +private: + static RFastLock iCacheLock; + static CFsClientMessageRequest* iFreeHead; + static CFsClientMessageRequest* iCloseHead; + + static TInt iRequestCount; // current number of requests + static TInt iFreeCount; // current number of requests on free queue + static TInt iRequestCountPeak; // maximum value of requests reached + }; + +class OperationAllocator + { +public: + static TInt Initialise(); + static TInt GetOperation(TMsgOperation* &aOperation); static void FreeOperation(TMsgOperation* aOperation); - - static void Initialise(); #if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE) - inline static TInt TotalCount(); - static TInt CloseCount(); - static TInt FreeCount(); - inline static TInt AllocatedCount(); -private: - static TInt iAllocated; + inline static TInt RequestCount(); + inline static TInt RequestCountPeak(); + inline static TInt FreeCount(); #endif -public: - static RFastLock iCacheLock; + private: - static TInt iAllocNum; - static CFsClientMessageRequest* iFreeHead; - static CFsClientMessageRequest* iCloseHead; + static RFastLock iCacheLock; + static TMsgOperation* iFreeHead; - static TInt iAllocNumOperation; - static TMsgOperation* iFreeHeadSupOp; + static TInt iRequestCount; // current number of requests + static TInt iFreeCount; // current number of requests on free queue + static TInt iRequestCountPeak; // maximum value of requests reached };