Skip to content

Instantly share code, notes, and snippets.


Justin McCartney turf00

View GitHub Profile
turf00 /
Created Oct 14, 2020
Git helpful

Git helpful

Clone a repo with limited history and specific branch

git clone --depth 10 --single-branch --branch <mybranch> <therepo>


JVM Flags

Useful JVM flags and links

Show me current flag settings

java -XX:+PrintFlagsFinal -version
turf00 /
Last active Apr 16, 2020
#!/usr/bin/env bash
set -euo pipefail
# pipefail
# e=if a command fails the shell will exit (i.e. return > 0)
# u=write an error when trying to expand a variable that is not set
# o=set pipefail When used in combination with set -e, pipefail will make a script exit if any command in a pipeline errors.
## Fetching params by name rather than position
View Linux

Linux Monitoring


free -m

List of availble memory and used memory before/after buffers and caches are taken into consideration.

Does not include the memory used for the kernel caches, i.e. Slab. This memory will contribute to the overall used memory but will not show against the process.

turf00 /
Last active Sep 14, 2018
JVM native memory stats

Java native memory

Stats were added in Java 8 when the permgen data was moved off heap.

Enabled by setting the option:


If you enable the summary or detailed information it is then possible to capture the stats using jcmd:

turf00 /
Last active Nov 25, 2019
Object layout

Compressed Oops

Oops stands for ordinary object pointer and refers to the object references in the JVM.

On 64bit hardware a pointer is sized at 64 bits, whereas in the 32bit world obviously 32bits.

32 bit means the addressable memory is 4GB.

64 bit means the addressable memory is 2^64 bytes, which is a lot.

turf00 /
Last active May 24, 2018
System Monitoring - Processes


Show stats for a particular process including voluntary and non-volunatary context switches

pidstat -w -p <pid> <interval secs>

e.g. pidstat -w -p 1345 1

turf00 /
Last active Oct 19, 2017
GC Detailed Logging to file

Enable GC detailed logging to a file, max size 5M, max number of files 10.

File will be labelled .0 to .x depending on the number of files.


Enable remote debugging on port 8000


You can’t perform that action at this time.