Mosdepth fails when run with less than 8GB RAM on ~50MB CRAM
Hi @brentp,

Mosdepth is using more memory than expected when ran with a .bed file on a ~50MB .cram file:
```
    local args=()
    args+=("--threads"  "1")
# enabling/disabling this line doesn't make a difference
#    args+=("--no-per-base")
    args+=("--by" "nanopore.bed")
    args+=("--thresholds" "1,5,10,15,20,30,50,100")
    args+=("--fasta" "<cut>/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.gz")
    args+=("mosdepth")
    args+=("vip_fam0_HG002.cram")
    ${CMD_MOSDEPTH} "${args[@]}"
```

We are running mosdepth 0.3.8 using a singularity apptainer image build from `docker://quay.io/biocontainers/mosdepth:0.3.8--hd299d5a_0`

I was expecting mosdepth to be able to run with much less memory based on the numbers reported in README and your comment in https://github.com/brentp/mosdepth/issues/161#issuecomment-979980608. Running with 16GB resolves the issue.

Data to reproduce the issue:
https://download.molgeniscloud.org/downloads/vip/_dev/github/mosdepth/
https://download.molgeniscloud.org/downloads/vip/resources/GRCh38/GCA_000001405.15_GRCh38_no_alt_analysis_set.fna.gz
https://download.molgeniscloud.org/downloads/vip/images/mosdepth-0.3.8.sif

Is this the behavior that you would expect?

Best regards,
@dennishendriksen


