From d9ff36bbdee315d21ee382ce2f66224f62d520d6 Mon Sep 17 00:00:00 2001 From: Evan Su <48808396+HACKERALERT@users.noreply.github.com> Date: Thu, 21 Nov 2024 23:36:11 -0500 Subject: [PATCH] debug.FreeOSMemory() often to reduce memory usage --- picocrypt/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/picocrypt/main.go b/picocrypt/main.go index f914253..aa0acfc 100644 --- a/picocrypt/main.go +++ b/picocrypt/main.go @@ -16,6 +16,7 @@ import ( "path/filepath" "strconv" "strings" + "runtime/debug" "time" "github.com/Picocrypt/infectious" @@ -242,6 +243,7 @@ func compress() int { return 1 } } + debug.FreeOSMemory() } writer.Close() file.Close() @@ -439,6 +441,7 @@ func work() int { } else { key = argon2.IDKey(password, salt, 4, 1<<20, 4, 32) } + debug.FreeOSMemory() tmp := sha3.New512() tmp.Write(key) keyHash = tmp.Sum(nil) @@ -593,6 +596,7 @@ func work() int { serpent = cipher.NewCTR(s, serpentIV) counter = 0 } + debug.FreeOSMemory() } if mode == "encrypt" {