Improve attachment memory allocation (#105)

* Improve attachment memory allocation

* added explicit garbage collection

* redundant GC

* added GCs in attachment processor and a FreeOSMemory helper

* added changelog

* linting

* Remove commented call to debug.FreeOSMemory

Co-authored-by: marin thiercelin <marin.thiercelin@pm.me>
Co-authored-by: marinthiercelin <marin.thiercelin@epfl.ch>
This commit is contained in:
wussler 2020-12-08 17:52:50 +01:00 committed by GitHub
parent 75f27fd1df
commit 6105a3bcc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package helper
import (
"encoding/json"
goerrors "errors"
"runtime/debug"
"github.com/ProtonMail/gopenpgp/v2/crypto"
"github.com/pkg/errors"
@ -124,3 +125,10 @@ func EncryptSignBinaryDetachedMobile(
EncryptedSignatureArmored: encryptedSignature,
}, nil
}
// FreeOSMemory can be used to explicitly
// call the garbage collector and
// return the unused memory to the OS.
func FreeOSMemory() {
debug.FreeOSMemory()
}