A customer is complaining that he's experiencing a memory leak in our Java application.
Despite all my efforts to reproduce his environment, configuration and usage, I wasn't able to reproduce, and thus identify, the leak.
I'd want to go down another path... Instead of trying to replicate it, maybe I could ask him to generate some view of his heap that would allow me to identify the leak.
Being run by the customer who would send it to me, there are some requirements on this:
A complete heap dump is impossible because of 1. and 2.
Most of all, it should allow me to find the leak. So it should at least show the retained heap size for objects of each class (size of itself + everything it keeps a reference to).
jmap -histo
is definitely not good enough.
num #instances #bytes class name
----------------------------------------------
1: 14156 577318512 [B
2: 9196 47439696 [I
3: 83396 9809992 [C
Is something like that useful at all? I don't think so.
To find a memory leak, look at how much RAM the system is using. The Resource Monitor in Windows can be used to accomplish this. In Windows 8.1 and Windows 10: To open the Run dialogue, press Windows+R, then type "resmon" and click OK.
The primary tools for detecting memory leaks are the C/C++ debugger and the C Run-time Library (CRT) debug heap functions. The #define statement maps a base version of the CRT heap functions to the corresponding debug version. If you leave out the #define statement, the memory leak dump will be less detailed.
To find memory leaks and inefficient memory usage, you can use tools such as the debugger-integrated Memory Usage diagnostic tool or tools in the Performance Profiler such as the . NET Object Allocation tool and the post-mortem Memory Usage tool.
Without knowing a bit more about you and your customers it is hard to comment but in my experience a customer telling me we have a memory leak (especially in Java) just means "customer's system has some problem that may or may not be related to our app"
I'd start by something as simple a finding out why he thinks your app has a leak (i.e. ps or task manager output showing process sizes)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With