From 52faf14f81ef6497fb074f0c1fc853bb824233d0 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sat, 1 Jan 2022 20:57:24 -0800
Subject: [PATCH] Save JS heap memory by using a hash of the achive contents
 for map key

Rather than the content listing itself (which can be a very long string).
---
 exec/dupefind.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/exec/dupefind.js b/exec/dupefind.js
index 453de7a74c..1c64716140 100755
--- a/exec/dupefind.js
+++ b/exec/dupefind.js
@@ -133,11 +133,12 @@ for(var i in dir_list) {
 				}
 			} catch(e) { }
 			if(contents) {
-				var key = JSON.stringify(contents);
+				var key = sha1_calc(JSON.stringify(contents));
 				if(!arc[key])
 					arc[key] = [];
 				arc[key].push(file);
 			}
+			contents = undefined;
 		}
 		total_bytes += file.size;
 	}
-- 
GitLab