fix perf for direct allocated memory