Skip to content

Commit

Permalink
Merge pull request #69 from Photoroom/ben/gc_often
Browse files Browse the repository at this point in the history
[nit] Force frequent GC
  • Loading branch information
blefaudeux authored Jan 21, 2025
2 parents 681991a + ba2788a commit 281e096
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func GetClient(config DatagoConfig) *DatagoClient {
vips.LoggingSettings(nil, vips.LogLevelWarning)
vips.Startup(nil)

// Make sure that the GC is run more often than usual
// VIPS will allocate a lot of memory and we want to make sure that it's released as soon as possible
os.Setenv("GOGC", "10") // Default is 100, we're running it when heap is 10% larger than the last GC

// Create the generator and backend
var generator Generator
var backend Backend
Expand Down

0 comments on commit 281e096

Please sign in to comment.