Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Memory leak with JPlanner (Read 9141 times)
florea
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Feb 13th, 2017
Memory leak with JPlanner
May 2nd, 2017 at 2:03pm
Print Post  
Hello,
   Every time when we create an instance of AwtCalendar, 3 threads are created but they are never removed from JVM even if you close the components that contains that instance of AwtCalendat (Popup/JFrame/Window etc). We noticed that, it is working well ONLY if you are using SwingUtilities.invokeLater for creating JPLanner component, is that mandatory? Our case: everytime when you press a button a popup is shown with an instance of AwtCalendar, we notice that if you close the popup the threads created by JPlanner are still alive.
Is there any option to close/kill/dispose these threads?
If you need an example please let us know, we already have an simple java project that simulates this behavior of JPlanner.
  
Back to top
 
IP Logged
 
florea
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Feb 13th, 2017
Re: Memory leak with JPlanner
Reply #1 - May 3rd, 2017 at 8:25am
Print Post  
You can use the archive attached, create a simple Java project, add JPlanner as dependency, and then run the main method from class TestThread, in the console you can see the number of thread which is increased every time you open a new popup with a JPlanner component (Press Add button), if you close a popup number of threads remains the same
  

testThread.zip (Attachment deleted)
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Memory leak with JPlanner
Reply #2 - May 3rd, 2017 at 12:24pm
Print Post  
Hi,

Thank you for your feedback. We were able to reproduce this problem and are currently working on resolving it. Keep in mind that in the upcoming new version there will be some API changes in the component so you may need to adjust your source code accordingly.

Regards,
Meppy
  
Back to top
 
IP Logged
 
florea
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Feb 13th, 2017
Re: Memory leak with JPlanner
Reply #3 - May 4th, 2017 at 7:15am
Print Post  
Hello,
  Good to hear that you are working on it. Do you have an estimation date when you will have a fix for it? And also, is it possible to have only a patch with the fix?
  We have a release on 23 of May, we really want to deliver in production the component we build with JPlanner.
  From what we saw, the issue might be the TimerTask fields from AwtCalendar and Scheduler that remains alive.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Memory leak with JPlanner
Reply #4 - May 4th, 2017 at 8:12am
Print Post  
Hi,

Please, have a try with the jar below.

https://mindfusion.eu/_temp/JPlanner.zip

The jar contains the following API changes:

  • The package com.mindfusion.scheduling.awt no longer exist.
  • The AwtCalendar no longer exists. Use the com.mindfusion.scheduling.Calendar now.
  • Enumerations that were previously integer fields are now true Java enums. For example, GroupType.
  • Flagged enums are now represented as EnumSet<> objects of the respective enum type.

Let me know if these changes can be easily done in your project. Finally, in order to close the threads that were previously left running, call the new dispose method of the Calendar class once you are done using it (e.g. when the popup containing the control is closed).

Regards,
Meppy
« Last Edit: May 4th, 2017 at 12:47pm by Meppy »  
Back to top
 
IP Logged
 
Ionut Murarasu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: May 4th, 2017
Re: Memory leak with JPlanner
Reply #5 - May 4th, 2017 at 11:14am
Print Post  
Hello,

I tried to add the new jar in our project but we have a problem.

There are some classes that we used from old jar and we cannot find in the new one. Find the list below:
- "com.mindfusion.drawing.Color"
- "com.mindfusion.drawing.Font"
- "com.mindfusion.common.Point"
- "com.mindfusion.common.Rectangle"
- "com.mindfusion.drawing.FontStyles"
- "com.mindfusion.common.MouseButtons"

Now all the calendar configurations has errors and we used a lot of these classes.
What can we do in this case ?


Best regards,
Ionut.
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Memory leak with JPlanner
Reply #6 - May 4th, 2017 at 12:45pm
Print Post  
Hi,

These classes have been removed as well. Here is what you can replace them with:

- "com.mindfusion.drawing.Color" => java.awt.Color
- "com.mindfusion.drawing.Font" => java.awt.Font
- "com.mindfusion.common.Point" => java.awt.Point
- "com.mindfusion.common.Rectangle" => java.awt.Rectangle
- "com.mindfusion.drawing.FontStyles" => use the constants in the java.awt.Font class: PLAIN, BOLD, and ITALIC
- "com.mindfusion.common.MouseButtons" => use the constants in the java.awt.event.MouseEvent class: BUTTON1, BUTTON2, BUTTON3

Basically the classes that mirrored various java.awt.* classes have been removed and the original AWT classes are now used instead. I am sorry for this inconvenience, but we are in the process of preparing a package with all our Java components and we had to bring the JPlanner's API in line with the other components in the package.

Kind regards,
Meppy
  
Back to top
 
IP Logged
 
florea
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Feb 13th, 2017
Re: Memory leak with JPlanner
Reply #7 - May 4th, 2017 at 3:14pm
Print Post  
Hello,
is there any option to receive the JPlanner 1.2 ONLY with this fix?
We tried to use you patch, but after doing a lot of refactoring (because of classes that were removed), we still have some functionalities that are not working properly?
We tried to change your source code to cancel all 3 Timer instances (Calendar._autoscollTimer and Calendar._delayEditTimer and one from Shedule._checkTimer) and it's working well, can you validate if this is a good solution to dispose a calendar when it is closed?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Memory leak with JPlanner
Reply #8 - May 5th, 2017 at 7:26am
Print Post  
Hi,

The dispose method in the new version does exactly this - cancels the running timers. So if you've done that manually, it should be equivalent to the new changes.

Just out of curiosity, what functionalities are not working properly with the new jar?

Regards,
Meppy
  
Back to top
 
IP Logged
 
florea
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Feb 13th, 2017
Re: Memory leak with JPlanner
Reply #9 - May 5th, 2017 at 7:53am
Print Post  
Hello,
Ok, I'm glad that we have the same solution as yours, so we stick with our changes. We will not adapt right now you patch, because our release is quite soon, and we don't have time enough to refactor now the code and to test everything again.
Regarding the functionalities that are not working properly we have these:
- creating appointment by using Mouse (so you can move existing appointments, but you cannot create new one)
- some default colors was changed (for multiple grouping view)
- because of FontType was removed, we had to identify which exactly Font from awt is the equivalent with FontType.Regular, in the previous implementation FontType.Regular is 0 (zero), so all text is not visible in the Font from awt, we had to increase it to ~12.
Thanks for you help.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint