Memory access optimization method