Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-15-2013, 09:10 PM   #1
Registered: Mar 2013
Posts: 555

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, 10:23 PM   #2
Senior Member
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,849
Blog Entries: 36

Rep: Reputation: 455Reputation: 455Reputation: 455Reputation: 455Reputation: 455
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...
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 10:38 PM.
Old 06-16-2013, 09:05 AM   #3
Registered: Mar 2013
Posts: 555

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, 05:14 PM   #4
Senior Member
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,293

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335

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.


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 10:36 AM
[SOLVED] Terminated pthreads decreasing memory, until Seg Fault truboy Linux - Software 1 01-04-2011 08:17 AM
Memory resources not decreasing Micro420 Linux - General 3 03-09-2007 07:17 AM
[SOLVED] Newbie asks: About lost memory and speed decreasing Flywelder Linux - Newbie 24 01-21-2007 02:00 PM
The used memory of application is increasing. Free space decreasing. Help needed. maheshnimje Linux - General 1 05-09-2006 12:16 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:25 AM.

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