0

I have a compiled .jar on my Mac that I run. Not only does it run slowly (lag sometimes), but I'm pretty sure it's leaking memory. It's a game client so it has an output stream/input stream. As I look at it in Activity Monitor its memory usage is constantly increasing.

Does anyone know of perhaps a "Java memory cleaner" for Mac? I know they have things like it for Windows that I've used when playing on there.

Also is there a way to optimize Java on the Mac so it runs faster? My internet is not lagging but sometimes there is lag ingame due to my system itself I'm pretty sure.

k9b
  • 1,457
  • 4
  • 24
  • 54
  • did you give the JVM more memory? http://stackoverflow.com/questions/2294268/how-can-i-increase-the-jvm-memory –  Mar 16 '14 at 14:37
  • Not that I know of its a compiled jar. Started at 550 mb now its climbed its way to 1gb – k9b Mar 16 '14 at 14:38
  • http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html garbage collection happens automatically in Java. Also you have to set a higher memory value manually on the JVM –  Mar 16 '14 at 14:39
  • here are some more tips for tuning your Java installation: http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html –  Mar 16 '14 at 14:48
  • Leak memory means that you have a wrong code in your program.. debug it. – Freddy Daniel Jul 29 '21 at 06:22

1 Answers1

0

Use the JVisualVM and detect where the memory is leaking and fix your program.

If you think its a Mac OS X specific problem i would say no, every OS acts different if you leave files/streams open till you can't open new ones. So watch for your IO actions.

Also what Java Version you are using would be a usefull information for such questions.

Java uses Garbage Collection, you don't need to have "Memory Cleaner thing"

Another thing: Maybe you close your streams in finalize blocks, don't do such stuff, that can be OS dependent and problems like yours could appear.

Zarathustra
  • 2,853
  • 4
  • 33
  • 62
  • Most up to date version there is. Thanks for the response – k9b Mar 16 '14 at 14:41
  • Which version exactly? JDK/JRE 7 U51 64 or 32bit? Is it a program/jar by you or someone other? Then they should fix this memory issue. Normally Java does all the garbage collection in the background. –  Mar 16 '14 at 14:46