Notification.Wpf
Notification.Wpf copied to clipboard
Memory increase issue
01. Status
- Found a phenomenon that the memory increases little by little when the UI linked with Notification.Wpf is continuously turned on
- Is there any way to prevent the current memory growth?
- Or is there a way to free the memory arbitrarily?
02.app.xaml.cs
using Notification.Wpf;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Timers;
using System.Windows;
namespace NotificationWPF_TEST
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
private NotificationManager _notifier;
private Timer aTimer;
private readonly double cycleTime = 7000; // 7s
public App()
{
_notifier = new NotificationManager();
}
protected override void OnStartup(StartupEventArgs e)
{
SetTimer();
aTimer.Stop();
aTimer.Dispose();
aTimer = new System.Timers.Timer(cycleTime);
aTimer.Elapsed += OnTimedEvent;
aTimer.Enabled = true;
}
private void SetTimer()
{
aTimer = new System.Timers.Timer(cycleTime);
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
aTimer.AutoReset = true;
aTimer.Enabled = true;
}
private void OnTimedEvent(Object source, ElapsedEventArgs e)
{
// Warning test1 test Warning
_notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000)); _notifier.Show(new NotificationContent
{
Message = " Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information Information test1 test Information",
Type = NotificationType.Information,
TrimType = NotificationTextTrimType.NoTrim, // will show attach button on message
}, expirationTime: TimeSpan.FromMilliseconds(5000));
}
}
}
-
Try setting the current ui to run randomly every 7 seconds
- It's really subtle, but there is a phenomenon that the memory gradually increases little by little.
-
Graphs for the current project
hello, thank you for the detailed description, I will try to find how to fix the situation
Any update?
fixed v7.0.0.2 can you check it @sunshineBlack