# Transfers Plugin Reduced Memory Usage Patch

**URL:** https://discourse.orthanc-server.org/t/transfers-plugin-reduced-memory-usage-patch/6479
**Category:** General
**Created:** [September 16, 2026, 2:26am UTC](https://discourse.orthanc-server.org/t/transfers-plugin-reduced-memory-usage-patch/6479 "2026-09-16T02:26:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![James](https://discourse.orthanc-server.org/letter_avatar_proxy/v4/letter/j/bc8723/32.png) [@James](https://discourse.orthanc-server.org/u/James)
#### Post date: [September 16, 2026, 2:26am UTC](https://discourse.orthanc-server.org/t/transfers-plugin-reduced-memory-usage-patch/6479/1 "2026-09-16T02:26:43Z")

</div>

Hi Orthanc team,

Following the recent streaming updates to Orthanc Server, I spent some time to improve memory usage associated with the Accelerated Transfers Plugin.

We’ve experienced issues using this plugin with very large dicom files in memory limited environments. My hope is this patch will help reduce the memory usage associated with importing large files via the Transfer Plugin.

I’ve attached a patch for the plugin with 2 changes:

1. Uses `SystemToolbox::ComputeFileMD5` helper to calculate the uploaded file streamed from the file system rather than reading the entire file into memory. This allows the plugin to calculate the MD5 with significantly less memory
2. Use `boost::iostreams::mapped_file_source` to upload the file rather than reading the entire file into memory to import it.

Full disclosure - I’m not a C++ expert. From the research I’ve done, [`mapped_file_source`](https://www.boost.org/doc/libs/latest/libs/iostreams/doc/classes/mapped_file.html) is supported cross platform (\*nix and Windows) and allows the OS to read the file directly from the file without allocating additional memory. This should further reduce memory usage during importing the file, removing the previous mirrored in-memory c string of the entire file.

The patch builds and I have run end to end tests that confirm the plugin is still working.

I welcome your review and comments.

[0001-stream-md5-mmap-commit.patch.txt](https://discourse.orthanc-server.org/uploads/short-url/g6wGbn7KjhZgtGVSeAR1KP6aXIJ.txt) (4.8 KB)

---

<div class="post-metadata">

### Author: ![alainmazy](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/alainmazy/32/1576_2.png) [@alainmazy](https://discourse.orthanc-server.org/u/alainmazy)
#### Post date: [September 21, 2026, 1:11pm UTC](https://discourse.orthanc-server.org/t/transfers-plugin-reduced-memory-usage-patch/6479/2 "2026-09-21T13:11:46Z")

</div>

Hi @James

Thanks for this contribution - I have [included it in the mainline](https://orthanc.uclouvain.be/hg/orthanc-transfers/rev/2691260b08c5).

And good news, it even compiles on Visual Studio 2008 and GCC 4.8 !

Best regards,

Alain.
