I'm running PS3 Media Server on Arch Linux, and it's using quite a bit of memory that I'm sure could be collected if the JVM would just try. Is there any way for me to get the process to garbage collect? Maybe I there's a signal I can send to it?
What I've done with my own Clojure programs is start a REPL server, then connect to the program's REPL and call (System/gc). PS3 Media Server has no such REPL, but maybe you could try patching and compiling it yourself to give it a Clojure REPL?
Name:
Anonymous2010-10-30 19:34
Stop micromanaging memory usage. If it's such a big problem, get a job and buy more RAM.
Name:
Anonymous2010-10-30 20:59
You can evoke Java's garbage collector manually inside your application, but there's no guarantee it'll do anything.
You should be able to force the JVM to GC, for example by recompiling or modifying the bytecode of your application.
In other cases one might not be as fortunate, for example I'm using a certain application written in SEPPLES right now and it's eating about 1.1GB of RAM at the moment due to memory leaks. A simple restart should get it in shape to some 40MB usage, at least for another day, when I'll have to restart it again.
>>8
It's a closed source application, and I'm not annoyed enough to actually reverse engineer the application to fix bugs that the original authors should fix.
>>13
The application is a client, it works with large streams of data, after which those streams are released, in the sense that you won't make use of them. The application is supposed to be in a "clean" slate after all of these streams have been released, yet I see some extra 1GB memory usage after a days usage - 1GB of memory which will never be used by the application again, and can't be used in any way by the user - restarting the application would return it back to the same exact state, except now it only uses 40MB. It's clearly a leak of sorts, but a restart is only a hotkey away, so it's not really a major concern for me right now.
Depending on how it is invoked, maybe the JVM can be told to prefer to garbage collect more often instead of expanding the heap? Isn't there a flag to set the maximum heap size?
But if there's actually a leak in OP's application code, (s)he would be better off taking heap snapshots and using a profiling tool like JProbe or Yourkit to find out what's holding all that memory.
Name:
Anonymous2010-11-01 13:02
use jconsole or visualvm to trigger a garbage collection. some other random jmx command line client should do the job, too.
No no no, there is a signal you can send to it, can't remember the name, but if you send signal 8 the jvm will collect any garbage and free to reduce memory.