Live data from Hacker News

Detecting a permgen memory leak in a Java application

smalldata.tech

1–10 of 15 posts

Re: Detecting a permgen memory leak in a Java application

#2
> Steps to use visualvm to profile memory for a standalone JBoss application:

> Allow visualvm to use 1024 Mb of RAM - in etc/visualvm.conf update -Xmx parameter to -J-Xmx1024m

And this is why I avoid all Java apps I can -- there is always a need for some memory tuning. C++, Lisp, Perl, Go, Python, even Javascript can all use all the memory in my computer have without any action on my part, only Java keeps having the problems with it.

Re: Detecting a permgen memory leak in a Java application

#3
post #2

> Steps to use visualvm to profile memory for a standalone JBoss application: > Allow visualvm to use 1024 Mb of RAM - in etc/visualvm.conf update -Xmx parameter to -J-Xmx1024m And this is why I avoid all Java apps I can -- there is always a need for some memory tuning. C++, Lisp, Perl, Go, Python, even Javascript can all use all the memory in my computer have without any action on my part, only Java keeps having the…

You are lucky to work in systems where using all the memory is an option. Our servers have 256GB of RAM and we must constrain the memory of all our java trading robots, and then tune (but if we tune it means we didnt predict correctly) or optimize (which is basically doing what you do in C++ if you re constrained: never malloc to the heap without knowing what you re doing)

As an anecdotal experience tells me here in my investment bank, the algo trading robots in C++ take an order of magnitude more time to get right, change, or fit their constraints than the java validation robots we work on, simply because the memory tooling in Java is really easier to use.

Re: Detecting a permgen memory leak in a Java application

#8
post #2

> Steps to use visualvm to profile memory for a standalone JBoss application: > Allow visualvm to use 1024 Mb of RAM - in etc/visualvm.conf update -Xmx parameter to -J-Xmx1024m And this is why I avoid all Java apps I can -- there is always a need for some memory tuning. C++, Lisp, Perl, Go, Python, even Javascript can all use all the memory in my computer have without any action on my part, only Java keeps having the…

It's nice to have inbuilt memory limits in programs. It's a nice demarcation to have.

Re: Detecting a permgen memory leak in a Java application

#10

Detecting? It's safe to assume that if there's any statics there's a permgen leak.

Mutable collection type static field members that are actually mutated, sure. Thread creation in a static initializer? Yeah, that’s going to be a leak- but what you said was:

> It’s safe to assume that if there’s any statics there’s a permgen leak.

private static final int INT_PHI = 0x9e3779b9; // this is a useful constant that can be inlined in JIT code output, and not a memory leak.

Post reply on HN