This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Memory usage
#1
Is there a reason the memory usage in HQ does not go down after a MM game is finsihed and MM closes? I noticed that after ever MM game that the memory used by HQ gets a little bigger.
Reply
#2
Yes, there is probably a one word answer to your problem.

JAVA

Java's memory management has always been god awful. Which is why when it was first released and I started playing with it I stopped. Of course... at that point I was running a computer with less memory than my Tablet so it was a huge problem then but not so much now.
Reply
#3
(02-14-2014, 11:50 AM)scJazz link Wrote: Java's memory management has always been god awful.

You're right, the memory management in C is so much better /s.

Quote:Is there a reason the memory usage in HQ does not go down after a MM game is finsihed and MM closes?

The short answer is because there's a memory leak, but I don't know offhand what is causing it.  How much memory are we talking about?  Like megabytes of memory?  10's of megabytes?  Have you tried resolving multiple games (more than 3 or 4)?  How are you measuring memory usage?  Are you using something like task manager in windows?
Reply
#4
yeah task manager. And its more like hundreds over time. I really have no idea what it is yet. Hq usually runs around 275mb at start with my campaign then can jump upwards of 200-400mb depending on how many scenarios I run in MM. I usually leave my comp on with HQ running for days so this may not be something most people have noticed or run across. I will try to keep better track of when and how much it goes up between MM sessions.

Just restarted HQ and starting javaw memory usage is 373,420mb. Will post again tomorrow after I run a few scenarios tonight (if I have time)
Reply
#5
Having a heap dump(s) would go a long way in figuring this out.  The way I would solve this would be to take a heap dump from MekHQ before running MM, then take one again after the MM game is closed, then maybe run 3 or 4 more games of MM and take another heap dump.

The heap dump is, as the name implies, a dump of all the memory taken up by the heap and you can analyse the dumps to see what variables are taking up memory.  By comparing the three dumps I outlined above, you should be able to see what's taking up more memory as you keep running MM games.

If you are willing to take the heap dumps and get them to me, it would make figuring out the issue a lot easier.  I have another post, here, that outlines how to take a heap dump.  They're large (as big as the heap, so in your case somewhere around 300MB) but they compress very well. 
Reply
#6
Also, some things stick around until Java does a garbage collection on them. I've also noticed MekHQ using more and more RAM for awhile, but then it goes back down. Which is after a garbage collection.

As far as I'm aware I've plugged all of the memory leaks in both MegaMek and MekHQ. At least all that Eclipse's warnings have complained about. With one exception, it complains about the server socket. However, I believe that is a false warning simply because the socket is closed in a different method.
Reply
#7
What kind of setup do you have for eclipse to spit out warning about memory leaks?
Reply
#8
First scenario completed around 4:30am est. Memory usage is 808mb at end of scenario and remained the same as of 12:04pm. So 8hrs at that rate. Will start the next scenario in a few hours and see how it runs during and at the end.
Reply
#9
(02-14-2014, 09:19 PM)BeeRockxs link Wrote: What kind of setup do you have for eclipse to spit out warning about memory leaks?

I shouldn't say memory leaks, since they're officially classified as "Resource" leaks. But they can still be a memory leak with unclosed files and such.
Some are false positives like I mentioned too.

As for the setup... whatever the defaults are. I don't change them. Worked the same with manually installed Eclipse when I was on Mageia 3, and now with Fedora packaged Eclipse on Fedora 20 (though, that may be because of keeping the same workspace...)
Reply
#10
A bit of necromancy here, but I am getting caught up after my hiatus. The memory leak on MM games through MHQ is a longstanding issue and according to Torren is also a problem in MekWars which is where I borrowed much of the code for starting up MM games from. I spent a good deal of time trying to track it down awhile back with no success. I even downloaded an eclipse plug-in that analyzed the memory heap specifically to look for leaks and couldn't figure it out. The basic problem is that something in the MM thread is not getting shut down.
Reply
#11
(04-29-2014, 10:53 AM)Taharqa link Wrote:A bit of necromancy here, but I am getting caught up after my hiatus. The memory leak on MM games through MHQ is a longstanding issue and according to Torren is also a problem in MekWars which is where I borrowed much of the code for starting up MM games from. I spent a good deal of time trying to track it down awhile back with no success. I even downloaded an eclipse plug-in that analyzed the memory heap specifically to look for leaks and couldn't figure it out. The basic problem is that something in the MM thread is not getting shut down.

I haven't checked to see if this is still present with some of the changes I made to the way games are launched. It probably is, but it should be checked for.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  High memory usage resolving scenarios with drophips, warships etc SirMegaV 28 9,792 07-14-2014, 09:58 AM
Last Post: Netzilla
  Usage for remote players sshagent 9 4,669 09-21-2012, 05:19 AM
Last Post: sshagent
  Adjusting Memory Usage in Megamek called by MekHQ Alemnyr 5 2,844 12-31-2011, 06:20 AM
Last Post: Alemnyr

Forum Jump:


Users browsing this thread: 1 Guest(s)