tunning log memory limit and add check function before reading