corrected use of omp barrier for memory management