optimized RAM usage while building dB-hash