AFNI proc stuck (THD_dset_to_vectim)

AFNI version info (afni -ver):
Precompiled binary macos_13_ARM: Apr 8 2025 (Version AFNI_25.1.00 'Maximinus')

#code text  
mkdir /Volumes/SSD/ds003721-download/Processed/Preprocessing_Film
dir_base=/Volumes/SSD/ds003721-download/Processed/Preprocessing_Film

subjects=(S11)

for subj in "${subjects[@]}"
  do
  mkdir $dir_base/$subj
  dir_func=/Volumes/SSD/ds003721-download/raw/$subj/func
  dir_sswarper=/Volumes/SSD/ds003721-download/Processed/SSwarper/$subj
  dir_out=/Volumes/SSD/ds003721-download/Processed/Preprocessing_Film/$subj

  cd $dir_out

  afni_proc.py \
  -subj_id ${subj}_Film \
  -out_dir $dir_out/Results \
  -dsets $dir_func/${subj}_task-Film_bold.nii \
  -blocks despike tshift align tlrc volreg mask regress \
  -copy_anat $dir_sswarper/anatSS.$subj.nii \
  -anat_has_skull no \
  -align_unifize_epi local \
  -align_opts_aea -cost lpc+ZZ \
      -giant_move \
      -check_flip \
  -volreg_align_e2a \
  -volreg_align_to MIN_OUTLIER \
  -volreg_tlrc_warp -tlrc_base MNI152_2009_template_SSW.nii.gz \
  -tlrc_NL_warp \
  -tlrc_NL_warped_dsets \
      $dir_sswarper/anatQQ.$subj.nii \
      $dir_sswarper/anatQQ.$subj.aff12.1D \
      $dir_sswarper/anatQQ.${subj}_WARP.nii \
  -volreg_post_vr_allin yes \
  -volreg_pvra_base_index MIN_OUTLIER \
  -mask_segment_anat yes \
  -mask_segment_erode yes \
  -regress_polort 2 \
  -regress_anaticor_fast \
  -regress_ROI CSFe \
  -regress_apply_mot_types demean deriv \
  -regress_motion_per_run \
  -regress_censor_motion 0.3 \
  -regress_censor_outliers 0.05 \
  -regress_skip_first_outliers 5 \
  -html_review_style pythonic \
  -execute
done

When I run the above script in Macbook terminal, it always stopped at "THD_dset_to_vectim: allocated 8825241600 bytes"

By stopped I mean it just freezes in this line, and then there are no more further files generated. But terminal is still taking up CPU.
This does not happen when I process shorter runs using the same script. I tried five subjects and always ended up with the same results.


Some files were still generated, but it is clear that the preprocessing isn't fully over.
Long runs are about 40 minutes each (TR= 1.19 seconds), shorter runs are about 10 minutes.

I really need some help. Thanks!!

Hello,

It looks like you are running out of RAM, and your mac might be just swapping to try to continue the processing, which can make it very slow (thrashing). That one allocation is about 9 GB, and there might even be other datasets in memory.

How much RAM do you have? In any case, it is probably not enough, though there may be other programs taking up RAM as well.

-rick