mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +00:00
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:
committed by
Ron Evans
parent
ea3b5dc689
commit
777d3f3ea5
@@ -33,7 +33,9 @@ func MakeGCStackSlots(mod llvm.Module) bool {
|
||||
|
||||
ctx := mod.Context()
|
||||
builder := ctx.NewBuilder()
|
||||
defer builder.Dispose()
|
||||
targetData := llvm.NewTargetData(mod.DataLayout())
|
||||
defer targetData.Dispose()
|
||||
uintptrType := ctx.IntType(targetData.PointerSize() * 8)
|
||||
|
||||
// Look at *all* functions to see whether they are free of function pointer
|
||||
@@ -326,6 +328,7 @@ func AddGlobalsBitmap(mod llvm.Module) bool {
|
||||
|
||||
ctx := mod.Context()
|
||||
targetData := llvm.NewTargetData(mod.DataLayout())
|
||||
defer targetData.Dispose()
|
||||
uintptrType := ctx.IntType(targetData.PointerSize() * 8)
|
||||
|
||||
// Collect all globals that contain pointers (and thus must be scanned by
|
||||
|
||||
Reference in New Issue
Block a user