Thank you Johann
I have to admit I have minimal experience with malloc, so before I will give a go, may I ask you what would be your expected script time? The time to write a csv with some 380.000 rows and 5 columns was 2-3 min with spripts using either file_append or printtocsv (see above).
Thank you
Sinuhet