LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-15-2013, 10:10 PM   #1
Altiris
Member
 
Registered: Mar 2013
Posts: 554

Rep: Reputation: Disabled
Minecraft Server - Memory not decreasing


Im not sure if this is how it works or if there is a memory bug but I have a MC server that I allocated 2GB of memory to (its running Bukkit) and I noticed that when I start it up it goes from 200MB (system idle memory) then to 600MB which is fine, and the memory increases as people join...HOWEVER when people leave the memory count is still high and doesnt go back down but the weird thing is that when they join back it doesnt go higher either.
 
Old 06-15-2013, 11:23 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,831
Blog Entries: 36

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
The behavior your describe is normal for Java applications.

What are your -Xms and -Xmx values? They set the minimum and maximum allocation pools for heap memory.

In general it is recommended for production environments (i.e. environments that are used by the public) to have the same values for -Xms and -Xmx. Java will fluxuate the heap memory between those two memory sizes. If the heap minimum memory size (-Xms) is below -Xmx and it needs to allocate more from the system then it will take extra time to allocate that memory for the heap. Because of that it is recommended to give the heap a fixed size by setting -Xms and -Xmx the same value.

For instance on the minecraft website they recommend starting the JVM with the following options for the dedicated server...
Code:
java -Xmx1024M -Xms1024M -jar minecraft_server.jar nogui
Just remember that your java application is actually a JVM (Java Virtual Machine). You can think of it like any other virtual machine where it emulates its own instruction set architecture and manages its own memory (in this case through garbage collection).

I'd also like to point out that Java has more types of memory than just the heap. Look up on google for types of java memory. That being said since there are other types of memory in Java than just the heap it is possible for your JVM to go above the maximum pool size set by -Xmx. You can control the sizes other types of Java memory by passing additional options but I don't need to get into that. For minecraft, the default sizes for other types of memory are fine and usually only adjusted to tune garbage collection.

If you would like a true representation of how your JVM is managing memory then you must connect jconsole to your JVM. The OS won't report true memory usage within the JVM otherwise.

Last edited by sag47; 06-15-2013 at 11:38 PM.
 
Old 06-16-2013, 10:05 AM   #3
Altiris
Member
 
Registered: Mar 2013
Posts: 554

Original Poster
Rep: Reputation: Disabled
Alright sweet thanks, I installed OpenJDK thinking Sun Java was a problem however I think OpenJDK is eating up my ram more than Sun Java so I will switch back.
 
Old 06-16-2013, 06:14 PM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,261

Rep: Reputation: 297Reputation: 297Reputation: 297
Hi

Are you really sure it's really a problem? If you've allocated 2 Gb on a dedicated server, shouldn't it use it? If it did free that memory to the OS, it would just be slower when it needs memory later. If you don't want it to use 2 Gb, simply allocate less. As sag47 said, if you really want to see how much memory is being used you need to use jconsole. If you use the computer for other things, you should just allocate less memory. If the server is not used, the memory will be swapped to disk if it's needed for other things.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Rewriting a script for running a minecraft server on Ubuntu Server cowboys1919 Linux - Server 7 07-11-2012 11:36 AM
[SOLVED] Terminated pthreads decreasing memory, until Seg Fault truboy Linux - Software 1 01-04-2011 09:17 AM
Memory resources not decreasing Micro420 Linux - General 3 03-09-2007 08:17 AM
[SOLVED] Newbie asks: About lost memory and speed decreasing Flywelder Linux - Newbie 24 01-21-2007 03:00 PM
The used memory of application is increasing. Free space decreasing. Help needed. maheshnimje Linux - General 1 05-09-2006 01:16 AM


All times are GMT -5. The time now is 11:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration