# Struggling to use Mmap with ZipArchives

**URL:** <https://discourse.julialang.org/t/struggling-to-use-mmap-with-ziparchives/129839>\
**Category:** General Usage\
**Tags:** mmap, ziparchives\
**Created:** [June 12, 2025, 3:08pm UTC](https://discourse.julialang.org/t/struggling-to-use-mmap-with-ziparchives/129839 "2025-06-12T15:08:15Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![TimG](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TimG](https://discourse.julialang.org/u/TimG)\
**Post date:** [June 14, 2025, 6:57am UTC](https://discourse.julialang.org/t/struggling-to-use-mmap-with-ziparchives/129839/11 "2025-06-14T06:57:55Z")

</div>

So this works after a fashon, but with two caveats:

The XLSX docs indicate that the user should use `openxlsx` with do-syntax to support reading larger-than-memory files. However, putting the `GC.gc` call into the do-block doesn’t work - it has to be outside the function. This pushes the `GC.gc()` call into the user’s code, which seems pretty undesirable. (edit: I guess I could wrap it in another function)

My second caveat is more a reflection on the ironies of life in general.

When I first started using XLSX.jl it was generally considered slow, and the reason for this was identified as a `GC.gc` call on every read and every write. See [here](https://discourse.julialang.org/t/xlsx-writexlsx-spends-excessive-time-in-gc-on-windows/120687), for instance.

Variously, it was suggested that a solution to this may be found by first, replacing ZipFiles.jl with ZipArchives.jl as a dependency of XLSX.jl, and then by replacing EzXML.jl with XML.jl. I made these switches, which was a bit of a magical mystery tour for me and took me quite some time. Now I’m finished I find I’m back where I started from, depending on `GC.gc()` to make the code run!

At least I gained a powerful learning experience!

---

_[View the full topic](https://discourse.julialang.org/t/struggling-to-use-mmap-with-ziparchives/129839)._
