Why system. gc () doesn't seem to affect some JVMs

I am developing a small Java utility that uses two structures: Encog and Jetty to provide neural network functionality for a website.

The code is "finished" in that it does everything that it needs, but I have some problems with memory usage. When working on my development machine, memory usage apparently fluctuates between about 4 MB and 13 MB when the application does something (training on neural networks), and at best it uses about 18 MB. This is a very good use, and I think this is due to the fact that I regularly call System.GC (). I do this because the processing time does not matter to me, but memory usage does.

So, everything works fine on my machine, but as soon as I posted it online on our server (shared unix hosting with memory limitations), it uses about 19 MB to start and reaches hundreds of MB of memory usage when performing actions, These are the same things I did when testing. The only way to reduce memory usage is to exit the application and restart it.

The only difference I can tell is the Java virtual machine it is running on. I don’t know about it, and I tried to find the reason why it acts in this way, but most of the documentation requires excellent knowledge of Java and virtual machines. Can someone please help with some reasons why this might happen, and maybe some things to try and stop it.

I looked at using GCJ to compile an application, but I don’t know if I need to do this a lot of time and if it really helps.

Thanks for the help!

  • UPDATE: Development on Mac OS 10.6.3 and the server is on Unix, but I don’t know what. (Server from WebFaction)
+3
source share
5 answers

I think this is due to the fact that I regularly call System.GC ().

You should not do this; it is almost never useful.

, , , . , , , - 32 -Xmx32m - , JVM, " ", , , , .

, 64- JVM , ( 30%), 32- JVM - .

+7

, :

  • System.gc (-XX: -DisableExplicitGC), , gc, vm. gc jvm
  • jvm , gc. , , vm .
+1

, JVM . - VM. differences , stackoverflow. , , . , tweek GC GC. -X, Sun JVM.

0

JVM , , "" ( ).

, , , , . , , JVM .

, , . -Xoptions, , JVM, , , , .

? , , JVM. jvisualvm .

0

, , , ? Jetty , . .

0

Source: https://habr.com/ru/post/1753738/


All Articles