Added option to use malloc instead of new when allocating plain data array