406 |
406 |
407 if (!memoryFreeingActionRun) |
407 if (!memoryFreeingActionRun) |
408 { |
408 { |
409 // No usable memory freeing action has been found, so we give up |
409 // No usable memory freeing action has been found, so we give up |
410 TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found"); |
410 TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found"); |
411 iMonitor.ResetTargets(); |
|
412 TInt freeMemory; |
411 TInt freeMemory; |
413 FreeMemoryAboveTarget(freeMemory); |
412 FreeMemoryAboveTarget(freeMemory); |
414 iServer.CloseAppsFinished(freeMemory, EFalse); |
413 iServer.CloseAppsFinished(freeMemory, EFalse); |
|
414 iMonitor.WaitAndSynchroniseMemoryState(); |
415 } |
415 } |
416 } |
416 } |
417 |
417 |
418 // Should be called when the memory situation is good |
418 // Should be called when the memory situation is good |
419 // It results in notifications of the good memory state to all plugins with an outstanding FreeMemory request |
419 // It results in notifications of the good memory state to all plugins with an outstanding FreeMemory request |
439 { |
439 { |
440 FUNC_LOG; |
440 FUNC_LOG; |
441 |
441 |
442 aFreeMemory = iMonitor.GetFreeMemory(); |
442 aFreeMemory = iMonitor.GetFreeMemory(); |
443 |
443 |
444 TRACES1("CGOomActionList::FreeMemoryAboveTarget: Free RAM now %d",aFreeMemory); |
444 TRACES2("CGOomActionList::FreeMemoryAboveTarget: Free RAM now %d, currentTarget %d",aFreeMemory, iCurrentTarget); |
445 |
445 |
446 return (aFreeMemory >= iCurrentTarget); |
446 return (aFreeMemory >= iCurrentTarget); |
447 } |
447 } |
448 |
448 |
449 TInt CGOomActionList::ComparePriorities(const TActionRef& aPos1, const TActionRef& aPos2 ) |
449 TInt CGOomActionList::ComparePriorities(const TActionRef& aPos1, const TActionRef& aPos2 ) |
598 if(iRunningKillAppActions) |
598 if(iRunningKillAppActions) |
599 { |
599 { |
600 iRunningKillAppActions = EFalse; |
600 iRunningKillAppActions = EFalse; |
601 // There are no more actions to try, so we give up |
601 // There are no more actions to try, so we give up |
602 TRACES1("CGOomActionList::StateChanged: All current actions complete, below good threshold with no more actions available. freeMemory=%d", freeMemory); |
602 TRACES1("CGOomActionList::StateChanged: All current actions complete, below good threshold with no more actions available. freeMemory=%d", freeMemory); |
603 iMonitor.ResetTargets(); |
603 |
604 /* Do not call memory good immidiately after freeing memory for some app |
604 /* Do not call memory good immidiately after freeing memory for some app |
605 if (freeMemory >= iCurrentTarget && !iMonitor.NeedToPostponeMemGood()) |
605 if (freeMemory >= iCurrentTarget && !iMonitor.NeedToPostponeMemGood()) |
606 { |
606 { |
607 MemoryGood(); |
607 MemoryGood(); |
608 } |
608 } |
609 */ |
609 */ |
610 iServer.CloseAppsFinished(freeMemory, EFalse); |
610 iServer.CloseAppsFinished(freeMemory, EFalse); |
|
611 iMonitor.WaitAndSynchroniseMemoryState(); |
611 } |
612 } |
612 else |
613 else |
613 { |
614 { |
614 TRACES1("CGOomActionList::StateChanged: All current Plugin actions complete, below good threshold, Time to kill bad guys. freeMemory=%d", freeMemory); |
615 TRACES1("CGOomActionList::StateChanged: All current Plugin actions complete, below good threshold, Time to kill bad guys. freeMemory=%d", freeMemory); |
615 iRunningKillAppActions = ETrue; |
616 iRunningKillAppActions = ETrue; |
616 iMonitor.RunCloseAppActions(iMaxPriority); |
617 iMonitor.RunCloseAppActions(iMaxPriority); |
617 } |
618 } |
618 iMonitor.WaitAndSynchroniseMemoryState(); |
619 |
619 } |
620 } |
620 else |
621 else |
621 { |
622 { |
622 // There are still more actions to try, so we continue |
623 // There are still more actions to try, so we continue |
623 TRACES1("CGOomActionList::StateChanged: All current actions complete, running more actions. freeMemory=%d", freeMemory); |
624 TRACES1("CGOomActionList::StateChanged: All current actions complete, running more actions. freeMemory=%d", freeMemory); |