change heapsort_file to malloc