builder: free LLVM objects after use

This reduces the TinyGo memory consumption when running

  make tinygo-test

from 5.8GB to around 2GB on my laptop.
This commit is contained in:
Ayke van Laethem
2022-04-19 15:31:23 +02:00
committed by Ron Evans
parent ea3b5dc689
commit 777d3f3ea5
13 changed files with 49 additions and 6 deletions
+3 -1
View File
@@ -114,7 +114,9 @@ func OptimizeReflectImplements(mod llvm.Module) {
defer builder.Dispose()
// Get a few useful object for use later.
uintptrType := mod.Context().IntType(llvm.NewTargetData(mod.DataLayout()).PointerSize() * 8)
targetData := llvm.NewTargetData(mod.DataLayout())
defer targetData.Dispose()
uintptrType := mod.Context().IntType(targetData.PointerSize() * 8)
// Look up the (reflect.Value).Implements() method.
var implementsFunc llvm.Value