Notification.Wpf icon indicating copy to clipboard operation
Notification.Wpf copied to clipboard

Memory increase issue

Open sunshineBlack opened this issue 2 years ago • 1 comments

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

    image

sunshineBlack avatar Nov 08 '22 07:11 sunshineBlack

hello, thank you for the detailed description, I will try to find how to fix the situation

Platonenkov avatar Nov 08 '22 08:11 Platonenkov

Any update?

mjanulaitis avatar Mar 10 '23 13:03 mjanulaitis

fixed v7.0.0.2 can you check it @sunshineBlack

Platonenkov avatar Jul 14 '23 07:07 Platonenkov