Adapted from documentation 'Reducing bitcoind memory usage' by @laanwj https://gist.github.com/laanwj/efe29c7661ce9b6620a7