[Applications.Common] Remove GC Timer from OnLowMemory() (#4548)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Wed, 7 Sep 2022 23:09:37 +0000 (08:09 +0900)
committerGitHub <noreply@github.com>
Wed, 7 Sep 2022 23:09:37 +0000 (08:09 +0900)
* Remove GC timer

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
* Add missing if statement

Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs

index 3b0a4ac..5a49c65 100644 (file)
@@ -221,22 +221,10 @@ namespace Tizen.Applications
             LowMemory?.Invoke(this, e);
             if (e.LowMemoryStatus == LowMemoryStatus.SoftWarning || e.LowMemoryStatus == LowMemoryStatus.HardWarning)
             {
-                double interval = new Random().Next(10 * 1000);
-                if (interval <= 0)
-                    interval = 10 * 1000;
-
-                sTimer = new System.Timers.Timer(interval);
-                sTimer.Elapsed += OnTimedEvent;
-                sTimer.AutoReset = false;
-                sTimer.Enabled = true;
+                System.GC.Collect();
             }
         }
 
-        private static void OnTimedEvent(Object source, ElapsedEventArgs e)
-        {
-            System.GC.Collect();
-        }
-
         /// <summary>
         /// Overrides this method if want to handle behavior when the system battery is low.
         /// If base.OnLowBattery() is not called, the event 'LowBattery' will not be emitted.