It is currently 29 Oct 2025, 12:30
   
Text Size

Extreme slowdowns and memory usage

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins

Re: Extreme slowdowns and memory usage

Postby Doublestrike » 12 Jan 2012, 03:07

As promised, here's a few initial screenshots from 4 heap dumps over about 25 minutes of play (20:13, 20:22, 20:34, 20:38). The largest slowdowns were happening at 20:34 (heapdump834.png).

The majority of the memory is "leaked" in the preloader for each one.

Looks like there's a problem with the text fields in ViewTabber, which are probably instances of spells on the Magic stack, and the mana labels in the player field pop up in some cases.

These heap dumps were taken from a JVM running inside Eclipse while using the match UI.

Interested to hear if this is valuable to anyone - if so, I can continue posting various results, or I'll bumble around myself until it's figured out.
Attachments
heapdump813.png
Start of first game, 8:13.
heapdump822.png
Start of second game, 8:22. Slight slowdown noticed.
heapdump834.png
Start of third game, 8:34. Massive slowdown noticed.
heapdump838.png
Start of fourth game, 8:38. Surprisingly fast recovery, but slowed down again quick.
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: Extreme slowdowns and memory usage

Postby slapshot5 » 12 Jan 2012, 11:24

I just checked in some fixes for un-necessary JTextArea instances in ViewTabber. I wouldn't think this would be a problem between matches, but certainly can become a problem if you Continue and Restart (without Quitting) in Constructed mode.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Extreme slowdowns and memory usage

Postby Doublestrike » 12 Jan 2012, 12:06

I've just been dumping and analyzing heaps for the last few hours and there is definitely a problem in ViewTabber, as Slapshot observed and hopefully resolved. There are cases where up to 16 instances of the same spell are dumped into the stack, which obviously piles up quickly. I'll attack again tomorrow night.

However, the analysis also showed that the observers and listeners are apparently all cleared up - the UI starts pretty much fresh each time a match starts. Just the tabber persist problem is eating a fair amount of memory.

Also, there are some thread safety issues with the card animations. I couldn't quickly find a solution that didn't cancel the animations, so these will remain for a while. Later, when I spiff up the UI with a few effects, I can revisit this problem and fix it permanently.
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: Extreme slowdowns and memory usage

Postby slapshot5 » 12 Jan 2012, 18:37

I think I found something with the image cache that could explain the difference between 1.1.8 and 1.2.0 especially in quest mode (which seems to be most commonly reported). I'll test tonight and check in. I'm trying to get some numbers to see if this resolves anything. Also trying to tweak a few things with the cache.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Extreme slowdowns and memory usage

Postby slapshot5 » 12 Jan 2012, 18:39

Doublestrike wrote:I've just been dumping and analyzing heaps for the last few hours and there is definitely a problem in ViewTabber, as Slapshot observed and hopefully resolved. There are cases where up to 16 instances of the same spell are dumped into the stack, which obviously piles up quickly. I'll attack again tomorrow night.
I cleared up some JTextArea things related to GameLog and Combat. Nothing with the Stack. I didn't see anything jump out at me there as being able to be released. Have at it. I'll be looking at ImageCache tonight.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Extreme slowdowns and memory usage

Postby silly freak » 12 Jan 2012, 19:24

slapshot5 wrote:I just checked in some fixes for un-necessary JTextArea instances in ViewTabber. I wouldn't think this would be a problem between matches, but certainly can become a problem if you Continue and Restart (without Quitting) in Constructed mode.

-slapshot5
slapshot5 wrote:
Doublestrike wrote:I've just been dumping and analyzing heaps for the last few hours and there is definitely a problem in ViewTabber, as Slapshot observed and hopefully resolved. There are cases where up to 16 instances of the same spell are dumped into the stack, which obviously piles up quickly. I'll attack again tomorrow night.
I cleared up some JTextArea things related to GameLog and Combat. Nothing with the Stack. I didn't see anything jump out at me there as being able to be released. Have at it. I'll be looking at ImageCache tonight.

-slapshot5
I also looked at the dumps and ViewTabber quickly, and before reading your post, it seemed to me that it must be that the FPanels, but not the Lists were cleared in the update method(s). Since the code was commented out in the rev I looked at, I guess that's exactly what you fixed.

Short version: If two of us got the same impression from the research, it can't be that wrong ;) I hope we found it!
___

where's the "trust me, that will work!" switch for the compiler?
Laterna Magica - blog, forum, project, 2010/09/06 release!
silly freak
DEVELOPER
 
Posts: 598
Joined: 26 Mar 2009, 07:18
Location: Vienna, Austria
Has thanked: 93 times
Been thanked: 25 times

Re: Extreme slowdowns and memory usage

Postby Doublestrike » 13 Jan 2012, 10:52

I'm pleased to report that my latest round of heap dumps have not shown anything out of the ordinary - no leaks, no memory-intensive operations (besides the usual: preloaded card pictures and graphics processing). This was after a fairly long session, where performance was reasonably quick the whole time. So it will be interesting to see the end user reports! :)
---
A joke is a very serious thing.
User avatar
Doublestrike
UI Programmer
 
Posts: 715
Joined: 08 Aug 2011, 09:07
Location: Bali
Has thanked: 183 times
Been thanked: 161 times

Re: Extreme slowdowns and memory usage

Postby Chris H. » 13 Jan 2012, 13:07

A lot of time and effort have gone into fixing the memory leak problems that were recently noticed and reported to the dev team. Doublestrike and Slapshot deserve our applause and we are very thankful. People should be able to now play long multi match sessions without noticing slow downs and pauses.

We have a new snapshot build for our testers to try out this weekend. We would appreciate any responses from our testers in reference to the old memory leak plus slowdown issues. If things are now better please let us know. :)

User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 14 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 14 users online :: 0 registered, 0 hidden and 14 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 14 guests

Login Form