Code clean up
IDEX-1264 Fixed calculating used memory