about summary refs log tree commit diff
path: root/src/nix-daemon
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-03-01T15·16+0100
committerEelco Dolstra <edolstra@gmail.com>2017-03-01T15·16+0100
commitfa125b9b28bea25a4eeb4d39a71a481563127cb9 (patch)
treec1c563a532a888a21afe402a6beb88423cede367 /src/nix-daemon
parentf61f67ddee12a976a0a6a20652e7c545b49fa46c (diff)
TeeSink: Pre-reserve string space
When receiving a very large file, this can prevent the string from
having tobe copied, which temporarily doubles memory consumption.
Diffstat (limited to 'src/nix-daemon')
-rw-r--r--src/nix-daemon/nix-daemon.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 174821884449..ab5826b0d1a7 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -583,12 +583,11 @@ static void performOp(ref<LocalStore> store, bool trusted, unsigned int clientVe
         if (!trusted && dontCheckSigs)
             dontCheckSigs = false;
 
-        TeeSource tee(from);
-        ParseSink sink;
-        parseDump(sink, tee);
+        TeeSink tee(from);
+        parseDump(tee, tee.source);
 
         startWork();
-        store->addToStore(info, tee.data, repair, dontCheckSigs, nullptr);
+        store->addToStore(info, tee.source.data, repair, dontCheckSigs, nullptr);
         stopWork();
         break;
     }