예제 #1
0
        /// <summary>
        /// Handles application memory limit changes.
        /// </summary>
        /// <param name="e">Instance of <see cref="AppMemoryUsageLimitChangingEventArgs"/>.</param>
        private void OnAppMemroyUsageLimitChanging(object sender, AppMemoryUsageLimitChangingEventArgs e)
        {
            if (MemoryManager.AppMemoryUsage >= e.NewLimit)
            {
                var fields = new LoggingFields();
                fields.AddUInt64("CurrentUsage", MemoryManager.AppMemoryUsage);
                fields.AddUInt64("NewLimit", e.NewLimit);
                TelemetryHelper.LogEventWithParams("MemUsageChanging", fields);

                ReduceMemoryUsage();
            }
        }