aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform/rtcalls.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-04-19 15:31:23 +0200
committerRon Evans <[email protected]>2022-05-30 07:53:28 +0200
commit777d3f3ea5a570615b615e323c977f73d6674507 (patch)
treeac5bf4b4e169f37b81cec5dfcddfc6e1b0814899 /transform/rtcalls.go
parentea3b5dc68979da59e6a62ed64bce7369ad1f0e22 (diff)
downloadtinygo-777d3f3ea5a570615b615e323c977f73d6674507.tar.gz
tinygo-777d3f3ea5a570615b615e323c977f73d6674507.zip
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.
Diffstat (limited to 'transform/rtcalls.go')
-rw-r--r--transform/rtcalls.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/transform/rtcalls.go b/transform/rtcalls.go
index 49f7f0d94..6cd5cc4c9 100644
--- a/transform/rtcalls.go
+++ b/transform/rtcalls.go
@@ -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