Jump to content


  • Please log in to reply
[Indev 17b / Linux] - High RAM Usage
7 replies to this topic - Started By Tramboc, Jan 21 2016 12:40 AM

#1 Tramboc

Tramboc
  • Members
  • 15 posts
  • Pip
  • Steam ID:Tramboc
  • LocationYour appendix

Posted 21 January 2016 - 12:40 AM

Hi,

 

The game uses 2 GB of RAM on the main menu. Originally I was using java 7 but I upgraded to 8 and the issue persists.

 

Log:

Spoiler


  • 0

Meow


#2 Rayvolution

Rayvolution
  • Developer
  • 1,909 posts
  • Pip
  • Steam ID:Rayvolution
  • LocationTexas

Posted 21 January 2016 - 06:00 PM

If you go into the play mode, map editor or drawing board then exit back to the main menu, does the memory usage increase or remain the same?

 

Also, does the memory usage ever fluctuate at all, or is it "locked" at 2048~ megs?


  • 0
Rise to Ruins Developer

#3 Tramboc

Tramboc
  • Members
  • 15 posts
  • Pip
  • Steam ID:Tramboc
  • LocationYour appendix

Posted 21 January 2016 - 08:53 PM

On the main menu it fluctuates between 1700 and 1900 MB. I made a new blank map in the map editor and it hovered between 2200 MB and 2300 MB constantly. Then when I quit back to the main menu it shot up to 2800ish MB but quickly fell to a constant 2575 MB. Going back into the map editor on the same map made it pass 3 GB at which point I force quit because I only have 3.7 GB.

 

I did the same process but going into a skirmish or the world map instead and they all had the same result.


  • 0

Meow


#4 Tramboc

Tramboc
  • Members
  • 15 posts
  • Pip
  • Steam ID:Tramboc
  • LocationYour appendix

Posted 29 January 2016 - 06:28 PM

On Indev 17d; still having this issue. I think I should mention that the memory use only increases when the game loads assets.

 

Seeing as I have two crappy computers running Linux, I did a test to compare how much memory the game uses on both.

 

Both machines have linux kernel 3.16 and java 8 installed.

 

Older computer runs Ubuntu 14.04 and has 6 GB of RAM.

I ran the game through steam and kept watch on the memory use with htop.

The game runs at a nice solid 1 fps, so I just let it sit on the welcome screen. On the welcome screen it often just sat at one value, changing very very little.

 

I ran and closed the game 5 times and here are the usages on the welcome screen:

 

1st:  880 MB

2nd: 720 MB

3rd:  805 MB

4th:  764 MB

5th:  776 MB

 

And here's a log from the 5th run:

 

Spoiler

 

So, it's pretty normal. I did the same process on my newer computer running Linux Mint 17 (basically ubuntu 14.04) with 4 GB of RAM.

 

1st:   2040 MB

2nd: 1884 MB

3rd:  1863 MB

4th:  1814 MB

5th:  1923 MB

 

Here's a log from the 5th run:

 

Spoiler

 

Okay so that wall thing is weird, not all of the logs have that. Two of them have that, and one of the two doesn't have the "Sturdy Wall" part.

 

Here's a log from the 4th run:

 

Spoiler

 

Also, I checked the logs on the older machine and the 4th log had both "Sturdy Wall" and "Wood Wall"

So I guess that's just an unrelated bug.

 

What could cause this difference in memory usage?

 

 


  • 0

Meow


#5 Rayvolution

Rayvolution
  • Developer
  • 1,909 posts
  • Pip
  • Steam ID:Rayvolution
  • LocationTexas

Posted 30 January 2016 - 01:54 PM

I'm honestly completely baffled by this behavior. I wonder if it could be something internal to Java? Maybe the JVM acts differently on different hardware? I would blame being on a different kernal, but you're using the same one! Unless it's something very specific to the version of Linux you're running, and not the actual kernal.

 

Can you replicate similar results with other Java based games, like Towns, Project Zomboid or Minecraft? All 3 of those use Java+LWJGL, and Towns also uses Slick2d (Something I use).

 

On the system with extremely high usage, how's the gameplay? Is the game suffering severely from the high usage, or is it just high?


  • 0
Rise to Ruins Developer

#6 Tramboc

Tramboc
  • Members
  • 15 posts
  • Pip
  • Steam ID:Tramboc
  • LocationYour appendix

Posted 30 January 2016 - 04:44 PM

I have an i5 with just the integrated intel 3000 graphics. The game runs at a nice and buttery 60 FPS with no visible performance issues. My CPU gets rather hot though, and the high memory usage just slows the system to a crawl.

I goofed around in 3079, 3089 and Minecraft for a bit, and the memory usage on those games never surpassed 900 MB

 

Now, I know nothing about java, but do the different values for "Maximum JVM Memory" on the logs for the two machines mean anything?


  • 0

Meow


#7 Rayvolution

Rayvolution
  • Developer
  • 1,909 posts
  • Pip
  • Steam ID:Rayvolution
  • LocationTexas

Posted 30 January 2016 - 05:28 PM

Maximum Memory is just what Java decided is the absolute most it's allowed to allocate (but hasn't yet). If your memory usage goes beyond that, the game will have an "Out of Memory" crash usually.

 

Java handles memory a lot differently than most native programs, and the nomenclature can be confusing, but basically;

- Used Memory: The actual literal amount of ram being used in the game.

- Free Memory: The amount leftover that's been loaded into the JVM, but the game isn't actively using.

- Total Memory: The total amount actually currently being allocated to the JVM. So in a sense, Total memory is whats being used by the JVM, but the JVM itself might not be using it internally in the game. This should be the sum of Used+Free memory and it's typically what the OS will report as the game's memory consumption even if the game isn't using it all.

- Maximum Memory: The maximum the JVM has decided it's allowed to have. If the Used Memory tries to exceed Total Memory, Total Memory will take more memory away from the system, up to the Maximum Memory. If it needs more, likely the game will crash. Maximum Memory is really just how much it potentially could use, if it needs it.

 

There is some overhead too, so if you look at your actual memory usage from Java, it's usually a little higher than the actual "Total Memory" reported in the game. Depends on the OS though, in Window's case it's usually about 100-200mb higher.


  • 0
Rise to Ruins Developer

#8 Tramboc

Tramboc
  • Members
  • 15 posts
  • Pip
  • Steam ID:Tramboc
  • LocationYour appendix

Posted 30 January 2016 - 06:47 PM

I see, that makes sense.


  • 0

Meow






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users