-
Notifications
You must be signed in to change notification settings - Fork 2
Java
$ java -XshowSettings:properties -version
http://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html
http://flysnowxf.iteye.com/blog/1162691
- top or ps -ef to find the pid
- top -p <pid>, then shift+h to show threads, and find the interesting tid
- jstack <pid> | grep -A 10 <tid>
http://ju.outofmemory.cn/entry/147496
http://www.cnblogs.com/yyyt/p/4307828.html
http://docs.oracle.com/javase/6/docs/technotes/tools/share/jstat.html
http://petermodzelewski.blogspot.com/2013/06/short-jhat-tutorial-diagnosing.html
Memory usage
$ jps -l $ jmap -histo:live 20627 $ jmap -dump:file=dump.map 20627 $ jhat -port 7401 -J-mx4G dump.map
Memory usage and GC times/timestamp. Where 1000 means 1ms, 5 means 5 times.
$ jstat -gcutil 20627 1000 5
// // @formatter:off // Comments // @formatter:on //
Windows -> Preferences -> Java -> Installed JREs -> Edit -> Default VM arguments:
-ea -XX:+CreateMinidumpOnCrash
WinDBG (hide it here):
srv*D:\SymbolCache*https://msdl.microsoft.com/download/symbols
for (StackTraceElement ste : Thread.currentThread().getStackTrace()) { System.out.println(ste); }
Bitwise operators in Java is not the same as that in C/C++. Read this great article for details.
Also see long & 0xFFFFFFFF vs. long & 0xFFFFFFFFL.
http://stackoverflow.com/questions/5085889/l-array-notation-where-does-it-come-from/12505922#12505922
[Z = boolean [B = byte [S = short [I = int [J = long [F = float [D = double [C = char [L = any non-primitives(Object)
To get the main data-type, you need: [Object].getClass().getComponentType(); It will return null if the “object” is not an array. to determine if it is an array, just call: [Any Object].getClass().isArray() or Class.class.isArray();
Created by Wenliang Zhang.