Why trimming in ffmpeg eats up so much memory?
Use better command: ffmpeg -i a.mp4 -i a.mp4 -i a.mp4 -filter_complex \
"[0:v]trim=start_frame=9000:end_frame=9001,crop=1280:100:0:0,setpts=PTS-STARTPTS[still1]; \
[1:v]trim=start_frame=9000:end_frame=9001,crop=100:100:600:500,setpts=PTS-STARTPTS[still2]; \
[2:v][still1]overlay=0:0:enable='between(t,61,62)'[v0]; \
[v0][still2]overlay=600:500:enable='between(t,61,62)'[v1]" \
-map [v1] -c:v libx264 -crf 17 -preset slow -y  p.mp4

This way ffmpeg will not keep frames it still needs in memory.